// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/lang.c
// Function: infix_to_postfix_conversion
Expnodeptr infix_to_postfix_conversion(Expnodeptr list)
{
 Expnodeptr s[STACKSIZE];
 int top = -1, currentop, stackop;
 Expnodeptr outputqueue = NULL, tmpoutput = NULL;
 Expnodeptr tmp = list, next;
 while (tmp)
  {
   next = tmp->next;
   if (tmp->type != NO_TYPE)
     tmpoutput = insert_into_exp_list(&outputqueue, tmpoutput, tmp);
   else 
     if (tmp->next && tmp->next->type == NO_TYPE && tmp->next->name[0] == '[') /*function token like myarray in myarray[*/
      {
       top++;
       s[top] = tmp;
      }
     else
       switch (tmp->name[0]) {
         case ',':while (top != -1 && s[top]->name[0] != '[') /*token is an array argument separator*/
                   {
                    tmpoutput = insert_into_exp_list(&outputqueue, tmpoutput, s[top]);
                    top--;
                   }
                  free_expnode(tmp);
                  if (top == -1)
                    return NULL;
                  break;
         case '[':
         case '(':top++;
                  s[top] = tmp;
                  break;
         case ']':while (top != -1 && s[top]->name[0] != '[')
                   {
                    tmpoutput = insert_into_exp_list(&outputqueue, tmpoutput, s[top]);
                    top--;
                   }
                  free_expnode(tmp);
                  if (top == -1)
                    return NULL;
                  free_expnode(s[top]);
                  top--;
                  tmpoutput = insert_into_exp_list(&outputqueue, tmpoutput, s[top]);
                  top--;         
                  break;
         case ')':while (top != -1 && s[top]->name[0] != '(')
                   {
                    tmpoutput = insert_into_exp_list(&outputqueue, tmpoutput, s[top]);
                    top--;
                   }
                  free_expnode(tmp);
                  if (top == -1)
                    return NULL;
                  free_expnode(s[top]);
                  top--;
                  break;
         default :currentop = listindexc(tmp->name[0], operators, 7);
                  if (currentop != -1)
                   {
                    if (top != -1)
                      stackop = listindexc(s[top]->name[0], operators, 7);
                    else 
                      stackop = -1;
                    while (stackop != -1 && has_higher_or_equal_precedence(stackop, currentop))
                     {
                      tmpoutput = insert_into_exp_list(&outputqueue, tmpoutput, s[top]);
                      top--;
                      if (top != -1)
                        stackop = listindexc(s[top]->name[0], operators, 7);
                      else 
                        stackop = -1;
                     }
                    top++;
                    s[top] = tmp;
                   }
                  break;
       }
   tmp = next;
  }
 while (top != -1)
  {
   tmpoutput = insert_into_exp_list(&outputqueue, tmpoutput, s[top]);
   top--;
  }
 if (tmpoutput)
   tmpoutput->next = NULL;
 return outputqueue;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f58, %rsp           # imm = 0x1F58
pushq $-0x1
popq %rax
xorl %ebx, %ebx
movl %eax, %r8d
xorl %r15d, %r15d
movq %r15, %r14
movq %rbx, %r13
testq %rdi, %rdi
je 0x31e2f
movq %rdi, %r12
movq 0x18(%rdi), %rdi
cmpl $-0x1, 0x8(%r12)
je 0x31b78
movq %r12, %rbx
movq %r12, %r15
testq %r14, %r14
je 0x31b43
movq %r12, 0x18(%r14)
movq %r13, %rbx
movq %r12, %r15
jmp 0x31b43
movslq %r8d, %rbp
testq %rdi, %rdi
je 0x31b9c
cmpl $-0x1, 0x8(%rdi)
jne 0x31b9c
movq (%rdi), %rax
cmpb $0x5b, (%rax)
jne 0x31b9c
leal 0x1(%rbp), %r8d
movq %r12, 0x18(%rsp,%rbp,8)
jmp 0x31c26
movq (%r12), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
je 0x31c1b
cmpl $0x5d, %eax
je 0x31c31
cmpl $0x2c, %eax
je 0x31c8e
cmpl $0x5b, %eax
je 0x31c1b
cmpl $0x29, %eax
jne 0x31cc6
movslq %r8d, %rax
movq %rax, %rbx
shlq $0x20, %rbx
leal -0x1(%rax), %r8d
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
cmpq $-0x1, %rax
je 0x31e0f
movq 0x10(%rsp,%rax,8), %rcx
movq (%rcx), %rdx
cmpb $0x28, (%rdx)
je 0x31d78
movq %rcx, %rdx
testq %r14, %r14
je 0x31c0a
movq %rcx, 0x18(%r14)
movq %r13, %rdx
decq %rax
addq %rsi, %rbx
decl %r8d
movq %rdx, %r13
movq %rcx, %r14
jmp 0x31be0
movslq %r8d, %rax
incl %r8d
movq %r12, 0x18(%rsp,%rax,8)
movq %r13, %rbx
movq %r14, %r15
jmp 0x31b43
movslq %r8d, %rax
movq %rax, %rbx
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
imulq %r15, %rbx
addl $-0x2, %r8d
movabsq $0x100000000, %rsi      # imm = 0x100000000
cmpq $-0x1, %rax
je 0x31e0f
movq 0x10(%rsp,%rax,8), %rcx
movq (%rcx), %rdx
cmpb $0x5b, (%rdx)
je 0x31d10
movq %rcx, %rdx
testq %r14, %r14
je 0x31c7d
movq %rcx, 0x18(%r14)
movq %r13, %rdx
decq %rax
addq %rsi, %rbx
decl %r8d
movq %rdx, %r13
movq %rcx, %r14
jmp 0x31c53
movslq %r8d, %r8
cmpq $-0x1, %r8
je 0x31e0f
movq 0x10(%rsp,%r8,8), %rax
movq (%rax), %rcx
cmpb $0x5b, (%rcx)
je 0x31d5f
movq %rax, %rcx
testq %r14, %r14
je 0x31cbb
movq %rax, 0x18(%r14)
movq %r13, %rcx
decq %r8
movq %rcx, %r13
movq %rax, %r14
jmp 0x31c91
movq %rdi, 0x8(%rsp)
movsbl %al, %edi
leaq 0x9b0f8(%rip), %rsi     # 0xccdcd
pushq $0x7
popq %rdx
movq %r8, %rbx
callq 0x35ff2
movq %rbx, %r8
movq 0x8(%rsp), %rdi
movq %r13, %rbx
movq %r14, %r15
movl %eax, 0x4(%rsp)
cmpl $-0x1, %eax
je 0x31b43
cmpl $-0x1, %r8d
jne 0x31dda
pushq $-0x1
popq %rbp
pushq $-0x1
popq %rdi
jmp 0x31d9f
movq %rdi, %rbp
movq %r12, %rdi
movq %r8, %r12
callq 0x31823
movq %rbx, %rax
negq %rax
sarq $0x1d, %rax
movq 0x10(%rsp,%rax), %rdi
callq 0x31823
movq %r12, %r8
movq %rbp, %rdi
movq %r15, %rax
subq %rbx, %rax
sarq $0x1d, %rax
movq 0x10(%rsp,%rax), %r15
movq %r15, %rbx
testq %r14, %r14
je 0x31b43
movq %r15, 0x18(%r14)
movq %r13, %rbx
jmp 0x31b43
movq %rdi, %rbx
movq %r12, %rdi
movq %r8, %r15
callq 0x31823
movq %r15, %r8
movq %rbx, %rdi
jmp 0x31c26
movq %rdi, %r15
movq %r12, %rdi
movq %r8, %r12
callq 0x31823
sarq $0x1d, %rbx
movq 0x10(%rsp,%rbx), %rdi
callq 0x31823
movq %r12, %r8
movq %r15, %rdi
jmp 0x31c26
movq %r13, %rbx
movq %r14, %r15
cmpl $-0x1, %edi
je 0x31df8
movl 0x4(%rsp), %esi
callq 0x31af7
testl %eax, %eax
je 0x31df8
movq 0x10(%rsp,%rbp,8), %r14
movq %r14, %r13
testq %r15, %r15
je 0x31dcb
movq %r14, 0x18(%r15)
movq %rbx, %r13
movq %r13, %rbx
pushq $-0x1
popq %rdi
movq %r14, %r15
addq $-0x1, %rbp
jae 0x31da5
movq 0x10(%rsp,%rbp,8), %rax
movq (%rax), %rax
movsbl (%rax), %edi
leaq 0x9afe1(%rip), %rsi     # 0xccdcd
pushq $0x7
popq %rdx
callq 0x35ff2
movl %eax, %edi
jmp 0x31d9f
incl %ebp
movslq %ebp, %rax
movq %r12, 0x10(%rsp,%rax,8)
movl %ebp, %r8d
movq 0x8(%rsp), %rdi
jmp 0x31b43
movq %r12, %rdi
callq 0x31823
xorl %r13d, %r13d
movq %r13, %rax
addq $0x1f58, %rsp           # imm = 0x1F58
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %r8d, %rax
cmpq $-0x1, %rax
je 0x31e57
movq 0x10(%rsp,%rax,8), %rcx
movq %rcx, %rdx
testq %r14, %r14
je 0x31e4c
movq %rcx, 0x18(%r14)
movq %r13, %rdx
decq %rax
movq %rdx, %r13
movq %rcx, %r14
jmp 0x31e32
testq %r14, %r14
je 0x31e1a
andq $0x0, 0x18(%r14)
jmp 0x31e1a