Created
September 16, 2024 17:52
-
-
Save zlfn/948c4a87bc1f0e8a01ffc4902d3d7ef4 to your computer and use it in GitHub Desktop.
C output of rand-text
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
| /* Provide Declarations */ | |
| #include <stdint.h> | |
| #ifndef __cplusplus | |
| typedef unsigned char bool; | |
| #endif | |
| #ifdef _MSC_VER | |
| #define __noreturn __declspec(noreturn) | |
| #else | |
| #define __noreturn __attribute__((noreturn)) | |
| #endif | |
| #ifndef _MSC_VER | |
| #define __forceinline __attribute__((always_inline)) inline | |
| #endif | |
| #if defined(__GNUC__) | |
| #define __HIDDEN__ __attribute__((visibility("hidden"))) | |
| #endif | |
| #if defined(__GNUC__) | |
| #define __ATTRIBUTELIST__(x) __attribute__(x) | |
| #else | |
| #define __ATTRIBUTELIST__(x) | |
| #endif | |
| #ifdef _MSC_VER /* Can only support "linkonce" vars with GCC */ | |
| #define __attribute__(X) | |
| #endif | |
| /* Global Declarations */ | |
| /* Types Declarations */ | |
| struct l_array_13_uint8_t; | |
| struct l_unnamed_1; | |
| struct l_array_17_uint8_t; | |
| struct l_unnamed_2; | |
| struct l_array_2_uint8_t; | |
| /* Function definitions */ | |
| /* Types Definitions */ | |
| struct l_array_13_uint8_t { | |
| uint8_t array[13]; | |
| }; | |
| #ifdef _MSC_VER | |
| #pragma pack(push, 1) | |
| #endif | |
| struct l_unnamed_1 { | |
| struct l_array_13_uint8_t field0; | |
| } __attribute__ ((packed)); | |
| #ifdef _MSC_VER | |
| #pragma pack(pop) | |
| #endif | |
| struct l_array_17_uint8_t { | |
| uint8_t array[17]; | |
| }; | |
| #ifdef _MSC_VER | |
| #pragma pack(push, 1) | |
| #endif | |
| struct l_unnamed_2 { | |
| struct l_array_17_uint8_t field0; | |
| } __attribute__ ((packed)); | |
| #ifdef _MSC_VER | |
| #pragma pack(pop) | |
| #endif | |
| struct l_array_2_uint8_t { | |
| uint8_t array[2]; | |
| }; | |
| /* Global Variable Declarations */ | |
| /* Function Declarations */ | |
| __noreturn void main(void) __ATTRIBUTELIST__((nothrow)); | |
| __noreturn void rust_begin_unwind(void* llvm_cbe__info) __ATTRIBUTELIST__((nothrow)) __HIDDEN__; | |
| void gprint(void* _2) __ATTRIBUTELIST__((nothrow)) __nonbanked; | |
| void gotogxy(uint8_t _3, uint8_t _4) __ATTRIBUTELIST__((nothrow)) __sdcccall(0); | |
| uint8_t waitpad(uint8_t _5) __ATTRIBUTELIST__((nothrow)) __preserves_regs(b, c, h, l); | |
| void waitpadup(void) __ATTRIBUTELIST__((nothrow)) __preserves_regs(a, b, c, d, e, h, l); | |
| void initarand(uint16_t _6) __ATTRIBUTELIST__((nothrow)) __sdcccall(0); | |
| uint8_t rand(void) __ATTRIBUTELIST__((nothrow)) __sdcccall(0); | |
| /* Global Variable Definitions and Initialization */ | |
| static const struct l_unnamed_1 alloc_8f2747133b40490c3bc778a33f7dbf0f = { { "Getting seed" } }; | |
| static const struct l_unnamed_2 alloc_5ab77305005cecdf37039b5ea6672d53 = { { "Push any key (1)" } }; | |
| static const struct l_unnamed_2 alloc_cfd000199608a6dcb9739ec230d962af = { { "Push any key (2)" } }; | |
| /* LLVM Intrinsic Builtin Function Bodies */ | |
| static __forceinline uint16_t llvm_shl_u16(uint16_t a, uint16_t b) { | |
| uint16_t r = a << b; | |
| return r; | |
| } | |
| static __forceinline uint16_t llvm_or_u16(uint16_t a, uint16_t b) { | |
| uint16_t r = a | b; | |
| return r; | |
| } | |
| /* Function Bodies */ | |
| __noreturn void main(void) { | |
| struct l_array_2_uint8_t llvm_cbe__26; /* Address-exposed local */ | |
| void* _1; | |
| /*tail*/ gprint((&alloc_8f2747133b40490c3bc778a33f7dbf0f)); | |
| /*tail*/ gotogxy(0, 1); | |
| /*tail*/ gprint((&alloc_5ab77305005cecdf37039b5ea6672d53)); | |
| uint8_t llvm_cbe_a = /*tail*/ waitpad(-1); | |
| /*tail*/ waitpadup(); | |
| /*tail*/ gotogxy(0, 2); | |
| /*tail*/ gprint((&alloc_cfd000199608a6dcb9739ec230d962af)); | |
| uint8_t llvm_cbe_b = /*tail*/ waitpad(-1); | |
| /*tail*/ waitpadup(); | |
| /*tail*/ initarand((llvm_or_u16((llvm_shl_u16((((uint16_t)(uint8_t)llvm_cbe_b)), 8)), (((uint16_t)(uint8_t)llvm_cbe_a))))); | |
| _1 = ((&(&llvm_cbe__26)->array[((int16_t)1)])); | |
| goto llvm_cbe_bb11; | |
| do { /* Syntactic loop 'bb11' to make GCC happy */ | |
| llvm_cbe_bb11:; | |
| uint8_t llvm_cbe_r = rand(); | |
| *((uint8_t*)&llvm_cbe__26) = llvm_cbe_r; | |
| *(uint8_t*)_1 = 0; | |
| gprint((&llvm_cbe__26)); | |
| goto llvm_cbe_bb11; | |
| } while (1); /* end of syntactic loop 'bb11' */ | |
| } | |
| __noreturn void rust_begin_unwind(void* llvm_cbe__info) { | |
| goto llvm_cbe_bb1; | |
| do { /* Syntactic loop 'bb1' to make GCC happy */ | |
| llvm_cbe_bb1:; | |
| goto llvm_cbe_bb1; | |
| } while (1); /* end of syntactic loop 'bb1' */ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment