// File: yeonnic[P]solparser/./tree.cpp
// Function: S_Function(__gnu_cxx::__normal_iterator<Token const*, std::vector<Token, std::allocator<Token>>>, SolTree&)
int S_Function(Tokit begin, SolTree &out){
  vector<SolTree> tmp;
  int count = 0;
  auto it = begin;

  cout << "S_Function() called!!" << endl;
  cout << "it->str : " << it->str << endl;

  if((it+1)->type == TokenType::lparen){
    it++; count++;
    for(; it->type != TokenType::rparen && it->type != TokenType::eof; it++){
      count++;
    }
    for(; it->type != TokenType::lbracket && it->type != TokenType::eof; it++){
      count++;
      if(it->type == TokenType::identifier){
        out.usemodifier.push_back(SolTree(it->str, NodeType::modifier));
      }
    }

    if(it->type == TokenType::lbracket){
      count++;
      it++;
    }

    for(; it->type != TokenType::rbracket && it->type != TokenType::eof; it++){
      int c = 0;
      switch(it->type){
        case TokenType::for_:
        case TokenType::while_:
        case TokenType::do_:
          if((it+1)->type == TokenType::lparen && (it+1)->type != TokenType::eof){
            auto p = SolTree(it->str, NodeType::loop);
            it++; count++;
            if((it-1)->type == TokenType::while_){
              c = S_while(it, p);
            } else if((it-1)->type == TokenType::for_){
              c = S_for(it, p);
            } else {
              c = S_do_while(it, p);
            }
            it += c;
            count += c;
            tmp.push_back(p);
          } else {
            cout << "loop error!! line : " << it->line << endl;
            exit(-1);
          }
          break;
        case TokenType::if_:
        case TokenType::else_:
          if((it+1)->type == TokenType::lparen && (it+1)->type != TokenType::eof){
            auto p = SolTree(it->str, NodeType::conditionalstatement);
            it++; count++;
            c = S_ConditionalStatement(it, p);
            it += c;
            count += c;
          } else {
            cout << "conditional statement error!! line : " << it->line << endl;
            exit(-1);
          }
          break;
      }
    }
  }
  return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x34de0
movl $0x0, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0x194ee(%rip), %rdi     # 0x4cfd0
leaq 0x4358(%rip), %rsi      # 0x37e41
callq 0x6320
movq %rax, -0x328(%rbp)
jmp 0x33af7
movq -0x328(%rbp), %rdi
movq 0x194bb(%rip), %rsi     # 0x4cfc0
callq 0x6360
jmp 0x33b0c
movq 0x194bd(%rip), %rdi     # 0x4cfd0
leaq 0x438d(%rip), %rsi      # 0x37ea7
callq 0x6320
movq %rax, -0x330(%rbp)
jmp 0x33b28
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq -0x330(%rbp), %rdi
movq %rax, %rsi
callq 0x62d0
movq %rax, -0x338(%rbp)
jmp 0x33b49
movq -0x338(%rbp), %rdi
movq 0x19469(%rip), %rsi     # 0x4cfc0
callq 0x6360
jmp 0x33b5e
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x34e20
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x34e00
cmpl $0x1d, 0x20(%rax)
jne 0x34219
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x34e60
movq %rax, -0x58(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq %rax, %rcx
xorl %eax, %eax
cmpl $0x1e, 0x20(%rcx)
movb %al, -0x339(%rbp)
je 0x33bcb
leaq -0x38(%rbp), %rdi
callq 0x34e00
cmpl $0x1, 0x20(%rax)
setne %al
movb %al, -0x339(%rbp)
movb -0x339(%rbp), %al
testb $0x1, %al
jne 0x33bd7
jmp 0x33c02
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x34e60
movq %rax, -0x60(%rbp)
jmp 0x33b9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3423a
jmp 0x33c04
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq %rax, %rcx
xorl %eax, %eax
cmpl $0x19, 0x20(%rcx)
movb %al, -0x33a(%rbp)
je 0x33c34
leaq -0x38(%rbp), %rdi
callq 0x34e00
cmpl $0x1, 0x20(%rax)
setne %al
movb %al, -0x33a(%rbp)
movb -0x33a(%rbp), %al
testb $0x1, %al
jne 0x33c43
jmp 0x33d21
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x34e00
cmpl $0x6, 0x20(%rax)
jne 0x33d08
movq -0x10(%rbp), %rax
addq $0x58, %rax
movq %rax, -0x348(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq %rax, %rsi
leaq -0x120(%rbp), %rdi
callq 0x6150
jmp 0x33c88
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movl $0x7, %edx
callq 0x34ed0
jmp 0x33ca2
movq -0x348(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x34ea0
jmp 0x33cb7
leaq -0x100(%rbp), %rdi
callq 0x80e0
leaq -0x120(%rbp), %rdi
callq 0x61f0
jmp 0x33d08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x33cf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x80e0
leaq -0x120(%rbp), %rdi
callq 0x61f0
jmp 0x3423a
jmp 0x33d0a
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x34e60
movq %rax, -0x128(%rbp)
jmp 0x33c04
leaq -0x38(%rbp), %rdi
callq 0x34e00
cmpl $0x19, 0x20(%rax)
jne 0x33d4b
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x34e60
movq %rax, -0x130(%rbp)
jmp 0x33d4d
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq %rax, %rcx
xorl %eax, %eax
cmpl $0x1a, 0x20(%rcx)
movb %al, -0x349(%rbp)
je 0x33d7d
leaq -0x38(%rbp), %rdi
callq 0x34e00
cmpl $0x1, 0x20(%rax)
setne %al
movb %al, -0x349(%rbp)
movb -0x349(%rbp), %al
testb $0x1, %al
jne 0x33d8c
jmp 0x34217
movl $0x0, -0x134(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x34e00
movl 0x20(%rax), %eax
movl %eax, -0x350(%rbp)
addl $-0x2c, %eax
subl $0x2, %eax
jb 0x3403e
jmp 0x33db6
movl -0x350(%rbp), %eax
addl $-0x2e, %eax
subl $0x2, %eax
ja 0x341fe
jmp 0x33dca
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x34e20
movq %rax, -0x140(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x34e00
movq %rax, %rcx
xorl %eax, %eax
cmpl $0x1d, 0x20(%rcx)
movb %al, -0x351(%rbp)
jne 0x33e2a
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x34e20
movq %rax, -0x148(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x34e00
cmpl $0x1, 0x20(%rax)
setne %al
movb %al, -0x351(%rbp)
movb -0x351(%rbp), %al
testb $0x1, %al
jne 0x33e39
jmp 0x33fdd
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq %rax, %rsi
leaq -0x208(%rbp), %rdi
callq 0x6150
jmp 0x33e53
leaq -0x1e8(%rbp), %rdi
leaq -0x208(%rbp), %rsi
movl $0xa, %edx
callq 0x34ed0
jmp 0x33e6d
leaq -0x208(%rbp), %rdi
callq 0x61f0
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x34e60
movq %rax, -0x210(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x34fa0
movq %rax, -0x218(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x34e00
cmpl $0x2f, 0x20(%rax)
jne 0x33f2c
movq -0x38(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x220(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x33910
movl %eax, -0x358(%rbp)
jmp 0x33ee1
movl -0x358(%rbp), %eax
movl %eax, -0x134(%rbp)
jmp 0x33f9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x61f0
jmp 0x3423a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x80e0
jmp 0x3423a
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x34fa0
movq %rax, -0x228(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x34e00
cmpl $0x2e, 0x20(%rax)
jne 0x33f79
movq -0x38(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x230(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x33a70
movl %eax, -0x134(%rbp)
jmp 0x33f9d
movq -0x38(%rbp), %rax
movq %rax, -0x238(%rbp)
movq -0x238(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x33a80
movl %eax, -0x134(%rbp)
jmp 0x33f9f
movslq -0x134(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x34fe0
movl -0x134(%rbp), %ecx
movl -0x2c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x35000
jmp 0x33fcf
leaq -0x1e8(%rbp), %rdi
callq 0x80e0
jmp 0x34039
movq 0x18fec(%rip), %rdi     # 0x4cfd0
leaq 0x3e6c(%rip), %rsi      # 0x37e57
callq 0x6320
movq %rax, -0x360(%rbp)
jmp 0x33ff9
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq -0x360(%rbp), %rdi
movl 0x24(%rax), %esi
callq 0x6600
movq %rax, -0x368(%rbp)
jmp 0x3401a
movq -0x368(%rbp), %rdi
movq 0x18f98(%rip), %rsi     # 0x4cfc0
callq 0x6360
jmp 0x3402f
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x63e0
jmp 0x341fe
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x34e20
movq %rax, -0x240(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x34e00
movq %rax, %rcx
xorl %eax, %eax
cmpl $0x1d, 0x20(%rcx)
movb %al, -0x369(%rbp)
jne 0x3409e
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x34e20
movq %rax, -0x248(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x34e00
cmpl $0x1, 0x20(%rax)
setne %al
movb %al, -0x369(%rbp)
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x340ad
jmp 0x341a0
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq %rax, %rsi
leaq -0x308(%rbp), %rdi
callq 0x6150
jmp 0x340c7
leaq -0x2e8(%rbp), %rdi
leaq -0x308(%rbp), %rsi
movl $0xb, %edx
callq 0x34ed0
jmp 0x340e1
leaq -0x308(%rbp), %rdi
callq 0x61f0
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x34e60
movq %rax, -0x310(%rbp)
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x318(%rbp)
movq -0x318(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x33850
movl %eax, -0x370(%rbp)
jmp 0x3412d
movl -0x370(%rbp), %eax
movl %eax, -0x134(%rbp)
movslq -0x134(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x34fe0
movl -0x134(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x80e0
jmp 0x341fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x61f0
jmp 0x3423a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x80e0
jmp 0x3423a
movq 0x18e29(%rip), %rdi     # 0x4cfd0
leaq 0x3cbe(%rip), %rsi      # 0x37e6c
callq 0x6320
movq %rax, -0x378(%rbp)
jmp 0x341bc
leaq -0x38(%rbp), %rdi
callq 0x34e00
movq -0x378(%rbp), %rdi
movl 0x24(%rax), %esi
callq 0x6600
movq %rax, -0x380(%rbp)
jmp 0x341dd
movq -0x380(%rbp), %rdi
movq 0x18dd5(%rip), %rsi     # 0x4cfc0
callq 0x6360
jmp 0x341f2
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x63e0
jmp 0x341fe
jmp 0x34200
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x34e60
movq %rax, -0x320(%rbp)
jmp 0x33d4d
jmp 0x34219
movl -0x2c(%rbp), %eax
movl %eax, -0x384(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x8ef0
movl -0x384(%rbp), %eax
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x8ef0
movq -0x40(%rbp), %rdi
callq 0x6620
nopl (%rax)