// File: /workspace/github_c_makefile_star2_O1/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
testq %rdi, %rdi
je 0x35a2d
movq %rdi, %rbp
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %ebx, %ebx
movq %rbp, %r14
movq 0x18(%rbp), %rbp
cmpl $-0x1, 0x8(%r14)
je 0x35714
testq %r12, %r12
je 0x35809
movq %r14, 0x18(%r12)
jmp 0x3580c
testq %rbp, %rbp
je 0x3572c
cmpl $-0x1, 0x8(%rbp)
jne 0x3572c
movq (%rbp), %rax
cmpb $0x5b, (%rax)
je 0x358ac
movq (%r14), %rax
movb (%rax), %al
movzbl %al, %ecx
cmpl $0x2b, %ecx
jle 0x3581d
cmpl $0x2c, %ecx
je 0x358bc
cmpl $0x5b, %ecx
je 0x358ac
cmpl $0x5d, %ecx
jne 0x35937
movq %rbp, 0x8(%rsp)
cmpl $-0x1, %r15d
sete %bpl
je 0x35a64
movslq %r15d, %r15
movq 0x10(%rsp,%r15,8), %rax
movq (%rax), %rcx
cmpb $0x5b, (%rcx)
je 0x357af
movq %rax, %rcx
movq %rax, %rdx
testq %r12, %r12
je 0x3578e
movq %rcx, 0x18(%r12)
movq %rbx, %rdx
subq $0x1, %r15
setb %bpl
jb 0x35a64
movq 0x10(%rsp,%r15,8), %rax
movq (%rax), %rsi
cmpb $0x5b, (%rsi)
movq %rdx, %rbx
movq %rcx, %r12
jne 0x3577b
movq %r14, %rdi
callq 0x35380
testb %bpl, %bpl
jne 0x35a84
movq %r15, %r14
shlq $0x20, %r14
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %r14
movslq %r15d, %rax
movq 0x10(%rsp,%rax,8), %rdi
callq 0x35380
sarq $0x1d, %r14
movq 0x10(%rsp,%r14), %rax
movq %rax, %rcx
testq %r12, %r12
je 0x357fa
movq %rax, 0x18(%r12)
movq %rbx, %rcx
addl $-0x2, %r15d
movq %rcx, %rbx
movq %rax, %r12
jmp 0x35a23
movq %r14, %rbx
movq %r14, %r12
testq %rbp, %rbp
jne 0x356f3
jmp 0x35a38
cmpl $0x28, %ecx
je 0x358ac
cmpl $0x29, %ecx
jne 0x35937
movq %rbp, 0x8(%rsp)
cmpl $-0x1, %r15d
sete %bpl
je 0x35a64
movslq %r15d, %r15
movq 0x10(%rsp,%r15,8), %rax
movq (%rax), %rcx
cmpb $0x28, (%rcx)
je 0x35886
movq %rax, %rcx
movq %rax, %rdx
testq %r12, %r12
je 0x35865
movq %rcx, 0x18(%r12)
movq %rbx, %rdx
subq $0x1, %r15
setb %bpl
jb 0x35a64
movq 0x10(%rsp,%r15,8), %rax
movq (%rax), %rsi
cmpb $0x28, (%rsi)
movq %rdx, %rbx
movq %rcx, %r12
jne 0x35852
movq %r14, %rdi
callq 0x35380
testb %bpl, %bpl
jne 0x35a84
movslq %r15d, %r15
movq 0x10(%rsp,%r15,8), %rdi
callq 0x35380
decl %r15d
jmp 0x35a23
movslq %r15d, %rax
incl %r15d
movq %r14, 0x18(%rsp,%rax,8)
jmp 0x3580f
movq %rbp, 0x8(%rsp)
cmpl $-0x1, %r15d
sete %bpl
je 0x35a64
movslq %r15d, %rax
movq 0x10(%rsp,%rax,8), %rsi
movq (%rsi), %rcx
cmpb $0x5b, (%rcx)
je 0x3591c
movq %rsi, %rcx
movq %rsi, %rdx
testq %r12, %r12
je 0x358f2
movq %rcx, 0x18(%r12)
movq %rbx, %rdx
subq $0x1, %rax
setb %bpl
jb 0x35a64
movq 0x10(%rsp,%rax,8), %rsi
movq (%rsi), %rdi
cmpb $0x5b, (%rdi)
movq %rdx, %rbx
movq %rcx, %r12
jne 0x358df
movl %eax, %r15d
movq %rcx, %r12
movq %rdx, %rbx
movq %r14, %rdi
callq 0x35380
testb %bpl, %bpl
movq 0x8(%rsp), %rbp
je 0x3580f
jmp 0x35a84
movsbl %al, %edi
leaq 0x9c48c(%rip), %rsi     # 0xd1dcd
movl $0x7, %edx
callq 0x3a3a8
cmpl $-0x1, %eax
je 0x3580f
movl %eax, %edi
cmpl $-0x1, %r15d
movq %rbp, 0x8(%rsp)
je 0x35986
movslq %r15d, %rax
movq 0x10(%rsp,%rax,8), %rax
movq (%rax), %rax
movl %edi, %ebp
movsbl (%rax), %edi
leaq 0x9c455(%rip), %rsi     # 0xd1dcd
movl $0x7, %edx
callq 0x3a3a8
movl %ebp, %edi
jmp 0x3598b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x35a15
movslq %r15d, %r15
movl %edi, %edx
xorl $0x3, %edx
movl %edi, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
setne %cl
movl %eax, %esi
xorl $0x2, %esi
orl %edx, %esi
setne %dl
cmpl %edi, %eax
jge 0x359bc
testb %cl, %cl
je 0x359bc
testb %dl, %dl
jne 0x35a09
movq 0x10(%rsp,%r15,8), %r13
movq %r13, %rbp
testq %r12, %r12
je 0x359d1
movq %r13, 0x18(%r12)
movq %rbx, %rbp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subq $0x1, %r15
jb 0x359fc
movq 0x10(%rsp,%r15,8), %rax
movq (%rax), %rax
movl %edi, %ebx
movsbl (%rax), %edi
leaq 0x9c3dd(%rip), %rsi     # 0xd1dcd
movl $0x7, %edx
callq 0x3a3a8
movl %ebx, %edi
movq %r13, %r12
movq %rbp, %rbx
cmpl $-0x1, %eax
jne 0x35997
jmp 0x35a0f
movq %rbx, %rbp
movq %r12, %r13
movq %rbp, %rbx
movq %r13, %r12
movslq %r15d, %rax
incl %r15d
movq %r14, 0x18(%rsp,%rax,8)
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
jmp 0x3580f
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpl $-0x1, %r15d
je 0x35a71
movslq %r15d, %rax
movq 0x10(%rsp,%rax,8), %rcx
movq %rcx, %r13
testq %r12, %r12
je 0x35a56
movq %rcx, 0x18(%r12)
movq %rbx, %r13
movq %rcx, %r12
movq %r13, %rbx
addq $-0x1, %rax
jb 0x35a41
jmp 0x35a77
movq %r14, %rdi
callq 0x35380
xorl %r13d, %r13d
jmp 0x35a84
movq %rbx, %r13
movq %r12, %rcx
testq %rcx, %rcx
je 0x35a84
movq $0x0, 0x18(%rcx)
movq %r13, %rax
addq $0x1f58, %rsp           # imm = 0x1F58
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq