Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2013 00:10
Show Gist options
  • Save anonymous/7966782 to your computer and use it in GitHub Desktop.
Save anonymous/7966782 to your computer and use it in GitHub Desktop.
/* Generated by Nimrod Compiler v0.9.2 */
/* (c) 2012 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
gcc -c -w -pipe -O3 -march=native -mfpmath=sse -fno-strict-aliasing -fomit-frame-pointer -I/home/bdsatish/foss/installed/nimrod/lib -o /home/bdsatish/Programming/benchmarks/fasta/nimcache/fasta.o /home/bdsatish/Programming/benchmarks/fasta/nimcache/fasta.c */
#define NIM_INTBITS 64
#include "nimbase.h"
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct E_Base E_Base;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct TSafePoint TSafePoint;
struct TGenericSeq {
NI len;
NI reserved;
};
typedef NIM_CHAR TY611[100000001];
struct NimStringDesc {
TGenericSeq Sup;
TY611 data;
};
typedef N_NIMCALL_PTR(void, TY891) (void* p, NI op);
struct TNimType {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY891 marker;
};
struct TNimObject {
TNimType* m_type;
};
struct E_Base {
TNimObject Sup;
E_Base* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (E_Base* e, void* ClEnv);
void* ClEnv;
} TY8826;
struct TSafePoint {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
TY8826 raiseAction;
};
struct TNimNode {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
N_NIMCALL(void, process_74002)(NimStringDesc* filename);
N_NIMCALL(FILE*, open_7632)(NimStringDesc* filename, NU8 mode, NI bufsize);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_NIMCALL(NIM_BOOL, endoffile_7668)(FILE* f);
N_NIMCALL(NimStringDesc*, readline_7724)(FILE* f);
N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
static N_INLINE(NF, HEX2F_65237)(NI x, NI y);
N_NIMCALL(NimStringDesc*, nsuformatFloat)(NF f, NU8 format, NI precision);
static N_INLINE(void, popSafePoint)(void);
N_NIMCALL(void, reraiseException)(void);
static N_INLINE(void, initStackBottom)(void);
N_NOINLINE(void, setStackBottom)(void* thestackbottom);
N_NOINLINE(void, systemInit)(void);
N_NOINLINE(void, systemDatInit)(void);
N_NOINLINE(void, parseutilsInit)(void);
N_NOINLINE(void, parseutilsDatInit)(void);
N_NOINLINE(void, strutilsInit)(void);
N_NOINLINE(void, strutilsDatInit)(void);
N_NOINLINE(void, fastaInit)(void);
N_NOINLINE(void, fastaDatInit)(void);
STRING_LITERAL(TMP22, ">", 1);
STRING_LITERAL(TMP25, "Homo_sapiens.GRCh37.67.dna_rm.chromosome.Y.fa", 45);
extern TSafePoint* exchandler_10226;
static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
(*s).hasRaiseAction = NIM_FALSE;
(*s).prev = exchandler_10226;
exchandler_10226 = s;
}
static N_INLINE(NF, HEX2F_65237)(NI x, NI y) {
NF result;
result = 0;
result = (((double) (x)) / ((double) (y)));
return result;
}
static N_INLINE(void, popSafePoint)(void) {
exchandler_10226 = (*exchandler_10226).prev;
}
N_NIMCALL(void, process_74002)(NimStringDesc* filename) {
NI gccount;
NI totalbasecount;
FILE* input;
TSafePoint TMP20;
gccount = 0;
totalbasecount = 0;
input = open_7632(filename, ((NU8) 0), -1);
pushSafePoint(&TMP20);
TMP20.status = setjmp(TMP20.context);
if (TMP20.status == 0) {
NF volatile gcfraction;
NimStringDesc* LOC13;
while (1) {
NIM_BOOL LOC3;
NimStringDesc* volatile line;
NIM_BOOL LOC5;
LOC3 = endoffile_7668(input);
if (!!(LOC3)) goto LA2;
line = readline_7724(input);
LOC5 = nsuStartsWith(line, ((NimStringDesc*) &TMP22));
if (!!(LOC5)) goto LA6;
{
NIM_CHAR volatile letter_74009;
NI volatile i_74041;
letter_74009 = 0;
i_74041 = 0;
while (1) {
if (!(i_74041 < line->Sup.len)) goto LA9;
letter_74009 = line->data[i_74041];
switch (((NU8)(letter_74009))) {
case 84:
case 65:
{
totalbasecount += 1;
}
break;
case 71:
case 67:
{
gccount += 1;
totalbasecount += 1;
}
break;
default:
{
}
break;
}
i_74041 += 1;
} LA9: ;
}
LA6: ;
} LA2: ;
gcfraction = HEX2F_65237(gccount, totalbasecount);
LOC13 = 0;
LOC13 = nsuformatFloat((gcfraction * 1.0000000000000000e+02), ((NU8) 1), 4);
printf("%s\012", (LOC13)->data);
popSafePoint();
}
else {
popSafePoint();
}
{
fclose(input);
}
if (TMP20.status != 0) reraiseException();
}
static N_INLINE(void, initStackBottom)(void) {
void* volatile locals;
locals = 0;
locals = ((void*) (&locals));
setStackBottom(locals);
}
int cmdCount;
char** cmdLine;
char** gEnv;
N_CDECL(void, NimMain)(void) {
systemDatInit();
parseutilsDatInit();
strutilsDatInit();
fastaDatInit();
initStackBottom();
systemInit();
parseutilsInit();
strutilsInit();
fastaInit();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_NOINLINE(void, fastaInit)(void) {
process_74002(((NimStringDesc*) &TMP25));
}
N_NOINLINE(void, fastaDatInit)(void) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment