// File: /workspace/github_c_makefile_star2_O0/stonezwr[P]SpiKL-IP/parser.C
// Function: Parser::Parse(char const*)
void Parser::Parse(const char * filename){
    int mnist_duration = 500; // the default mnist duration (duration of the possion spike train)
    int i;
    char linestring[8192];
    char ** token = new char*[64];
    FILE * fp = fopen(filename,"r");
    assert(fp != NULL);

    assert(fp != 0);
    while(fgets(linestring, 8191, fp) != NULL){
        if(strlen(linestring) <= 1) continue;
        if(linestring[0] == '#') continue;

        token[0] = strtok(linestring," \t\n");
        assert(token[0] != NULL);

       if(strcmp(token[0],"neurongroup")==0){
            // neurongroup name number
            token[1] = strtok(NULL," \t\n");
            assert(token[1] != NULL);
            token[2] = strtok(NULL," \t\n");
            assert(token[2] != NULL);
            token[3] = strtok(NULL," \t\n");
            assert(token[3] != NULL);
            // read the v_mem from the netlist if applicable
            token[4] = strtok(NULL," \t\n");
            double v_mem = token[4] == NULL ? LSM_V_THRESH : atof(token[4]);
            ParseNeuronGroup(token[1], atoi(token[2]), token[3], v_mem);
        }else if(strcmp(token[0],"column")==0){
            token[1] = strtok(NULL," \t\n");
            assert(token[1] != NULL);
            token[2] = strtok(NULL," \t\n");
            assert(token[2] != NULL);
            token[3] = strtok(NULL," \t\n");
            assert(token[3] != NULL);
            token[4] = strtok(NULL," \t\n");
            assert(token[4] != NULL);

            assert(_network->CheckExistence(token[1]) == false);
            int dim1 = atoi(token[2]);
            int dim2 = atoi(token[3]);
            int dim3 = atoi(token[4]);
            assert((dim1>0)&&(dim2>0)&&(dim3>0));
            _network->LSMAddNeuronGroup(token[1],dim1,dim2,dim3);
        }else if(strcmp(token[0],"lsmsynapse")==0){
            token[1] = strtok(NULL," \t\n");
            assert(token[1] != NULL);
            token[2] = strtok(NULL," \t\n");
            assert(token[2] != NULL);
            token[3] = strtok(NULL," \t\n");
            assert(token[3] != NULL);
            token[4] = strtok(NULL," \t\n");
            assert(token[4] != NULL);
            token[5] = strtok(NULL," \t\n");
            assert(token[5] != NULL);
            token[6] = strtok(NULL," \t\n");
            assert(token[6] != NULL);
            token[7] = strtok(NULL," \t\n");
            assert(token[7] != NULL);

            assert(_network->CheckExistence(token[1]) == true);
            assert(_network->CheckExistence(token[2]) == true);

            ParseLSMSynapse(token[1],token[2],atoi(token[3]),atoi(token[4]),atoi(token[5]),atoi(token[6]),token[7]);
        }else if(strcmp(token[0],"speech")==0){
            token[1] = strtok(NULL," \t\n");
            assert(token[1] != NULL);
            token[2] = strtok(NULL," \t\n");
            assert(token[2] != NULL);

            ParseSpeech(atoi(token[1]),token[2]);
        }else if(strcmp(token[0],"end")==0){
            break;
        }else{
            cout<<token[0]<<endl;
            assert(0);
        }

    }
    fclose(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2090, %rsp           # imm = 0x2090
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2050(%rbp)
movl $0x1f4, -0x14(%rbp)     # imm = 0x1F4
movl $0x200, %edi            # imm = 0x200
callq 0x4030
movq %rax, -0x2028(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x9ad1(%rip), %rsi      # 0x348f2
callq 0x4430
movq %rax, -0x2030(%rbp)
cmpq $0x0, -0x2030(%rbp)
je 0x2ae39
jmp 0x2ae58
leaq 0xb6bc(%rip), %rdi      # 0x364fc
leaq 0xb6c0(%rip), %rsi      # 0x36507
movl $0x23, %edx
leaq 0xb6bd(%rip), %rcx      # 0x36510
callq 0x4210
cmpq $0x0, -0x2030(%rbp)
je 0x2ae64
jmp 0x2ae83
leaq 0xb6c6(%rip), %rdi      # 0x36531
leaq 0xb695(%rip), %rsi      # 0x36507
movl $0x25, %edx
leaq 0xb692(%rip), %rcx      # 0x36510
callq 0x4210
jmp 0x2ae85
leaq -0x2020(%rbp), %rdi
movq -0x2030(%rbp), %rdx
movl $0x1fff, %esi           # imm = 0x1FFF
callq 0x45f0
cmpq $0x0, %rax
je 0x2b811
leaq -0x2020(%rbp), %rdi
callq 0x4180
cmpq $0x1, %rax
ja 0x2aebb
jmp 0x2ae85
movsbl -0x2020(%rbp), %eax
cmpl $0x23, %eax
jne 0x2aec9
jmp 0x2ae85
leaq -0x2020(%rbp), %rdi
leaq 0xb662(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, (%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2aef8
jmp 0x2af17
leaq 0x9b35(%rip), %rdi      # 0x34a34
leaq 0xb601(%rip), %rsi      # 0x36507
movl $0x2b, %edx
leaq 0xb5fe(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2028(%rbp), %rax
movq (%rax), %rdi
leaq 0xb615(%rip), %rsi      # 0x3653d
callq 0x4520
cmpl $0x0, %eax
jne 0x2b0d2
xorl %eax, %eax
movl %eax, %edi
leaq 0xb5f8(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2af64
jmp 0x2af83
leaq 0x9ada(%rip), %rdi      # 0x34a45
leaq 0xb595(%rip), %rsi      # 0x36507
movl $0x30, %edx
leaq 0xb592(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb5ab(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2afb1
jmp 0x2afd0
leaq 0xb591(%rip), %rdi      # 0x36549
leaq 0xb548(%rip), %rsi      # 0x36507
movl $0x32, %edx
leaq 0xb545(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb55e(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x2affe
jmp 0x2b01d
leaq 0xb555(%rip), %rdi      # 0x3655a
leaq 0xb4fb(%rip), %rsi      # 0x36507
movl $0x34, %edx
leaq 0xb4f8(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb511(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x2b05b
movsd 0x9567(%rip), %xmm0     # 0x345b8
movsd %xmm0, -0x2058(%rbp)
jmp 0x2b073
movq -0x2028(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x4490
movsd %xmm0, -0x2058(%rbp)
movsd -0x2058(%rbp), %xmm0
movsd %xmm0, -0x2038(%rbp)
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2060(%rbp)
movq -0x2028(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x45c0
movq -0x2050(%rbp), %rdi
movq -0x2060(%rbp), %rsi
movl %eax, %edx
movq -0x2028(%rbp), %rax
movq 0x18(%rax), %rcx
movsd -0x2038(%rbp), %xmm0
callq 0x2b830
jmp 0x2b80c
movq -0x2028(%rbp), %rax
movq (%rax), %rdi
leaq 0xb488(%rip), %rsi      # 0x3656b
callq 0x4520
cmpl $0x0, %eax
jne 0x2b33d
xorl %eax, %eax
movl %eax, %edi
leaq 0xb43d(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2b11f
jmp 0x2b13e
leaq 0x991f(%rip), %rdi      # 0x34a45
leaq 0xb3da(%rip), %rsi      # 0x36507
movl $0x3b, %edx
leaq 0xb3d7(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb3f0(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2b16c
jmp 0x2b18b
leaq 0xb3d6(%rip), %rdi      # 0x36549
leaq 0xb38d(%rip), %rsi      # 0x36507
movl $0x3d, %edx
leaq 0xb38a(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb3a3(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x2b1b9
jmp 0x2b1d8
leaq 0xb39a(%rip), %rdi      # 0x3655a
leaq 0xb340(%rip), %rsi      # 0x36507
movl $0x3f, %edx
leaq 0xb33d(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb356(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x2b206
jmp 0x2b225
leaq 0xb365(%rip), %rdi      # 0x36572
leaq 0xb2f3(%rip), %rsi      # 0x36507
movl $0x41, %edx
leaq 0xb2f0(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2050(%rbp), %rax
movq (%rax), %rdi
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x1d1c0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2b24b
jmp 0x2b26a
leaq 0xb331(%rip), %rdi      # 0x36583
leaq 0xb2ae(%rip), %rsi      # 0x36507
movl $0x43, %edx
leaq 0xb2ab(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2028(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x45c0
movl %eax, -0x203c(%rbp)
movq -0x2028(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x45c0
movl %eax, -0x2040(%rbp)
movq -0x2028(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x45c0
movl %eax, -0x2044(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x203c(%rbp)
movb %al, -0x2061(%rbp)
jle 0x2b2de
xorl %eax, %eax
cmpl $0x0, -0x2040(%rbp)
movb %al, -0x2061(%rbp)
jle 0x2b2de
cmpl $0x0, -0x2044(%rbp)
setg %al
movb %al, -0x2061(%rbp)
movb -0x2061(%rbp), %al
testb $0x1, %al
jne 0x2b2ea
jmp 0x2b2ec
jmp 0x2b30b
leaq 0xa0e6(%rip), %rdi      # 0x353d9
leaq 0xb20d(%rip), %rsi      # 0x36507
movl $0x47, %edx
leaq 0xb20a(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2050(%rbp), %rax
movq (%rax), %rdi
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rsi
movl -0x203c(%rbp), %edx
movl -0x2040(%rbp), %ecx
movl -0x2044(%rbp), %r8d
callq 0x1dc10
jmp 0x2b80a
movq -0x2028(%rbp), %rax
movq (%rax), %rdi
leaq 0xb261(%rip), %rsi      # 0x365af
callq 0x4520
cmpl $0x0, %eax
jne 0x2b6c1
xorl %eax, %eax
movl %eax, %edi
leaq 0xb1d2(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2b38a
jmp 0x2b3a9
leaq 0x96b4(%rip), %rdi      # 0x34a45
leaq 0xb16f(%rip), %rsi      # 0x36507
movl $0x4b, %edx
leaq 0xb16c(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb185(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2b3d7
jmp 0x2b3f6
leaq 0xb16b(%rip), %rdi      # 0x36549
leaq 0xb122(%rip), %rsi      # 0x36507
movl $0x4d, %edx
leaq 0xb11f(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb138(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x2b424
jmp 0x2b443
leaq 0xb12f(%rip), %rdi      # 0x3655a
leaq 0xb0d5(%rip), %rsi      # 0x36507
movl $0x4f, %edx
leaq 0xb0d2(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb0eb(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x2b471
jmp 0x2b490
leaq 0xb0fa(%rip), %rdi      # 0x36572
leaq 0xb088(%rip), %rsi      # 0x36507
movl $0x51, %edx
leaq 0xb085(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb09e(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x2b4be
jmp 0x2b4dd
leaq 0xb0f5(%rip), %rdi      # 0x365ba
leaq 0xb03b(%rip), %rsi      # 0x36507
movl $0x53, %edx
leaq 0xb038(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb051(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x2b50b
jmp 0x2b52a
leaq 0xb0b9(%rip), %rdi      # 0x365cb
leaq 0xafee(%rip), %rsi      # 0x36507
movl $0x55, %edx
leaq 0xafeb(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xb004(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x2b558
jmp 0x2b577
leaq 0xb07d(%rip), %rdi      # 0x365dc
leaq 0xafa1(%rip), %rsi      # 0x36507
movl $0x57, %edx
leaq 0xaf9e(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2050(%rbp), %rax
movq (%rax), %rdi
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x1d1c0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2b59d
jmp 0x2b5bc
leaq 0xb049(%rip), %rdi      # 0x365ed
leaq 0xaf5c(%rip), %rsi      # 0x36507
movl $0x59, %edx
leaq 0xaf59(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2050(%rbp), %rax
movq (%rax), %rdi
movq -0x2028(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x1d1c0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2b5e2
jmp 0x2b601
leaq 0xb02f(%rip), %rdi      # 0x36618
leaq 0xaf17(%rip), %rsi      # 0x36507
movl $0x5a, %edx
leaq 0xaf14(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2080(%rbp)
movq -0x2028(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x2078(%rbp)
movq -0x2028(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x45c0
movl %eax, -0x2070(%rbp)
movq -0x2028(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x45c0
movl %eax, -0x206c(%rbp)
movq -0x2028(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x45c0
movl %eax, -0x2068(%rbp)
movq -0x2028(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x45c0
movq -0x2050(%rbp), %rdi
movq -0x2080(%rbp), %rsi
movq -0x2078(%rbp), %rdx
movl -0x2070(%rbp), %ecx
movl -0x206c(%rbp), %r8d
movl -0x2068(%rbp), %r9d
movl %eax, %r10d
movq -0x2028(%rbp), %rax
movq 0x38(%rax), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2ba10
jmp 0x2b808
movq -0x2028(%rbp), %rax
movq (%rax), %rdi
leaq 0x95b1(%rip), %rsi      # 0x34c83
callq 0x4520
cmpl $0x0, %eax
jne 0x2b7a5
xorl %eax, %eax
movl %eax, %edi
leaq 0xae4e(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2b70e
jmp 0x2b72d
leaq 0x9330(%rip), %rdi      # 0x34a45
leaq 0xadeb(%rip), %rsi      # 0x36507
movl $0x5f, %edx
leaq 0xade8(%rip), %rcx      # 0x36510
callq 0x4210
xorl %eax, %eax
movl %eax, %edi
leaq 0xae01(%rip), %rsi      # 0x36539
callq 0x45d0
movq %rax, %rcx
movq -0x2028(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x2028(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2b75b
jmp 0x2b77a
leaq 0xade7(%rip), %rdi      # 0x36549
leaq 0xad9e(%rip), %rsi      # 0x36507
movl $0x61, %edx
leaq 0xad9b(%rip), %rcx      # 0x36510
callq 0x4210
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x45c0
movq -0x2050(%rbp), %rdi
movl %eax, %esi
movq -0x2028(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x2baf0
jmp 0x2b806
movq -0x2028(%rbp), %rax
movq (%rax), %rdi
leaq 0x9971(%rip), %rsi      # 0x35127
callq 0x4520
cmpl $0x0, %eax
jne 0x2b7c2
jmp 0x2b811
movq -0x2028(%rbp), %rax
movq (%rax), %rsi
movq 0x217f5(%rip), %rdi     # 0x4cfc8
callq 0x4360
movq %rax, %rdi
movq 0x217d6(%rip), %rsi     # 0x4cfb8
callq 0x43b0
leaq 0x9b2a(%rip), %rdi      # 0x35318
leaq 0xad12(%rip), %rsi      # 0x36507
movl $0x68, %edx
leaq 0xad0f(%rip), %rcx      # 0x36510
callq 0x4210
jmp 0x2b808
jmp 0x2b80a
jmp 0x2b80c
jmp 0x2ae85
movq -0x2030(%rbp), %rdi
callq 0x4370
addq $0x2090, %rsp           # imm = 0x2090
popq %rbp
retq
nopw %cs:(%rax,%rax)