Created
June 3, 2019 09:35
-
-
Save CreateRemoteThread/e2a8238db758c1b47849ef23088838cd 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
// | |
// This file was generated by the Retargetable Decompiler | |
// Website: https://retdec.com | |
// Copyright (c) 2019 Retargetable Decompiler <info@retdec.com> | |
// | |
#include <signal.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
// ---------------- Integer Types Definitions ----------------- | |
typedef int64_t int128_t; | |
// ----------------- Float Types Definitions ------------------ | |
typedef float float32_t; | |
typedef double float64_t; | |
// ------------------------ Structures ------------------------ | |
struct _IO_FILE { | |
int32_t e0; | |
}; | |
// ------------------- Function Prototypes -------------------- | |
int64_t chart_course(int64_t * a1); | |
// --------------------- Global Variables --------------------- | |
struct _IO_FILE * g1 = NULL; | |
struct _IO_FILE * g2 = NULL; | |
// ------------------------ Functions ------------------------- | |
// Address range: 0x400855 - 0x400993 | |
int64_t chart_course(int64_t * a1) { | |
int32_t v1 = 0; | |
while (true) { | |
int64_t v2 = v1; // 0x400868 | |
int32_t v3 = v1 + (int32_t)(v1 < 0); // 0x4008bb | |
int32_t v4 = v3 / 2; // 0x4008bd | |
int64_t v5 = v4 + -10 * (v4 / 10 - (v3 >> 31)); // 0x4008dd | |
if (v1 % 2 != 0) { | |
// 0x4008b3 | |
printf("LON[%d]: ", v5); | |
} else { | |
// 0x400872 | |
printf("LAT[%d]: ", v5); | |
} | |
// 0x4008f2 | |
int64_t str; // bp-120 | |
fgets((char *)&str, 100, g2); | |
int32_t v6; | |
if (strncmp((char *)&str, "done", 4) != 0) { | |
float64_t str_as_f = atof((char *)&str); // 0x400945 | |
int64_t v7 = __asm_movss(__asm_cvtsd2ss((int128_t)(int32_t)(float32_t)str_as_f)); // 0x40094e | |
memset(&str, 0, 100); | |
int64_t v8 = __asm_movss(__asm_movss_1((int32_t)v7)); // 0x400982 | |
*(int32_t *)(4 * v2 + (int64_t)a1) = (int32_t)v8; | |
v6 = v1; | |
} else { | |
if (v1 % 2 == 0) { | |
// break -> 0x40098f | |
break; | |
} | |
// 0x40092e | |
puts("WHERES THE LONGITUDE?"); | |
v6 = v1 - 1; | |
} | |
// 0x400986 | |
v1 = v6 + 1; | |
} | |
// 0x40098f | |
return 0; | |
} | |
// Address range: 0x400993 - 0x400a20 | |
int main(int argc, char ** argv) { | |
// 0x400993 | |
setbuf(g1, NULL); | |
setbuf(g2, NULL); | |
alarm(30); | |
__sysv_signal(14, (void (*)(int32_t))0x400836); | |
puts(" _ .--. \n ( ` ) \n .-' `--, \n _..----.. ( )`-. \n .'_|` _|` _|( .__, )\n /_| _| _| _( (_, .-' \n ;| _| _| _| '-'__,--'`--' \n | _| _| _| _| | \n _ || _| _| _| _| \n _( `--.\\_| _| _| _|/ \n .-' )--,| _| _|.` \n (__, (_ ) )_| _| / \n `-.__.\\ _,--'\\|__|__/ \n ;____; \n \\YT/ \n || \n |\"\"| \n '==' \n\nWHERE WOULD YOU LIKE TO GO?"); | |
int64_t v1; // bp-56 | |
memset(&v1, 0, 40); | |
chart_course(&v1); | |
puts("BON VOYAGE!"); | |
return 0; | |
} | |
// --------------- Dynamically Linked Functions --------------- | |
// __sighandler_t __sysv_signal(int sig, __sighandler_t handler); | |
// unsigned int alarm(unsigned int seconds); | |
// double atof(const char * nptr); | |
// char * fgets(char * restrict s, int n, FILE * restrict stream); | |
// void * memset(void * s, int c, size_t n); | |
// int printf(const char * restrict format, ...); | |
// int puts(const char * s); | |
// void setbuf(FILE * restrict stream, char * restrict buf); | |
// int strncmp(const char * s1, const char * s2, size_t n); | |
// --------------------- Meta-Information --------------------- | |
// Detected compiler/packer: gcc (5.4.0) | |
// Detected functions: 2 | |
// Decompilation date: 2019-06-01 20:22:14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment