Created
December 12, 2013 06:35
-
-
Save sayurin/7924021 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
#ifdef _MSC_VER | |
#define IO_H "io.h" | |
#define _CRT_NONSTDC_NO_WARNINGS | |
#define __attribute__(X) | |
#else | |
#define IO_H "unistd.h" | |
#define __pragma(X) | |
#define __declspec(X) | |
#define __fastcall | |
#endif | |
#include IO_H | |
__pragma(code_seg(".text")) __declspec(allocate(".text")) const char calculate[] __attribute__((section(".text#"))) = { | |
0x53, | |
0x51, | |
0x56, | |
0x57, | |
0x55, | |
0x8b, 0xf1, | |
0x8b, 0xf9, | |
0x8b, 0xea, | |
0x33, 0xc9, | |
0x0f, 0xb6, 0x06, | |
0x46, | |
0x83, 0xe8, 0x30, | |
0x72, 0x08, | |
0x8d, 0x0c, 0x89, | |
0x8d, 0x0c, 0x48, | |
0xeb, 0xef, | |
0x33, 0xdb, | |
0x0f, 0xb6, 0x06, | |
0x46, | |
0x83, 0xe8, 0x30, | |
0x72, 0x08, | |
0x8d, 0x1c, 0x9b, | |
0x8d, 0x1c, 0x58, | |
0xeb, 0xef, | |
0x33, 0xd2, | |
0x0f, 0xb6, 0x06, | |
0x46, | |
0x83, 0xe8, 0x30, | |
0x72, 0x08, | |
0x8d, 0x14, 0x92, | |
0x8d, 0x14, 0x50, | |
0xeb, 0xef, | |
0xc6, 0x44, 0x15, 0x00, 0x01, | |
0xe2, 0xe6, | |
0xb9, 0x09, 0x00, 0x00, 0x00, | |
0x41, | |
0x80, 0x7c, 0x0d, 0x00, 0x00, | |
0x74, 0xf8, | |
0x33, 0xd2, | |
0x0f, 0xb6, 0x06, | |
0x46, | |
0x83, 0xe8, 0x30, | |
0x72, 0x08, | |
0x8d, 0x14, 0x92, | |
0x8d, 0x14, 0x50, | |
0xeb, 0xef, | |
0x51, | |
0x53, | |
0x57, | |
0x8b, 0xfa, | |
0x2b, 0xf9, | |
0xeb, 0x01, | |
0x4f, | |
0x80, 0x7c, 0x3d, 0x00, 0x00, | |
0x74, 0xf8, | |
0x33, 0xdb, | |
0x8d, 0x04, 0x39, | |
0x3b, 0xc2, | |
0x74, 0x1f, | |
0x77, 0x0f, | |
0x3b, 0xc3, | |
0x0f, 0x47, 0xd8, | |
0x41, | |
0x80, 0x7c, 0x0d, 0x00, 0x00, | |
0x74, 0xf8, | |
0xeb, 0x08, | |
0x4f, | |
0x80, 0x7c, 0x3d, 0x00, 0x00, | |
0x74, 0xf8, | |
0x3b, 0xf9, | |
0x77, 0xdc, | |
0x8b, 0xc3, | |
0x5f, | |
0x5b, | |
0x3d, 0xa0, 0x86, 0x01, 0x00, | |
0x73, 0x15, | |
0x3d, 0x10, 0x27, 0x00, 0x00, | |
0x73, 0x1c, | |
0x3d, 0xe8, 0x03, 0x00, 0x00, | |
0x73, 0x23, | |
0x83, 0xf8, 0x64, | |
0x73, 0x2c, | |
0xeb, 0x34, | |
0x33, 0xd2, | |
0xb9, 0xa0, 0x86, 0x01, 0x00, | |
0xf7, 0xf1, | |
0x0c, 0x30, | |
0xaa, | |
0x8b, 0xc2, | |
0x33, 0xd2, | |
0xb9, 0x10, 0x27, 0x00, 0x00, | |
0xf7, 0xf1, | |
0x0c, 0x30, | |
0xaa, | |
0x8b, 0xc2, | |
0x33, 0xd2, | |
0xb9, 0xe8, 0x03, 0x00, 0x00, | |
0xf7, 0xf1, | |
0x0c, 0x30, | |
0xaa, | |
0x8b, 0xc2, | |
0xb1, 0x64, | |
0xf6, 0xf1, | |
0x0c, 0x30, | |
0xaa, | |
0x0f, 0xb6, 0xc4, | |
0xb1, 0x0a, | |
0xf6, 0xf1, | |
0x66, 0x0d, 0x30, 0x30, | |
0x66, 0xab, | |
0xc6, 0x07, 0x0a, | |
0x47, | |
0x59, | |
0x4b, | |
0x0f, 0x85, 0x4c, 0xff, 0xff, 0xff, | |
0x8b, 0xc7, | |
0x5d, | |
0x5f, | |
0x5e, | |
0x59, | |
0x5b, | |
0x2b, 0xc1, | |
0xc3, | |
}; | |
#define VALUE_LENGTH (2 + 500000 + 300) | |
int main() { | |
static char buffer[VALUE_LENGTH * 7] = {0}; | |
static char prices[1000001] = {0}; | |
read(0, buffer, VALUE_LENGTH * 7); | |
int length = (*(int(__fastcall __attribute__((fastcall)) *)(char *, char *))calculate)(buffer, prices); | |
write(1, buffer, length); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment