// File: /workspace/github_c_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x36420
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f58, %rsp           # imm = 0x1F58
movq %rdi, %r13
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %rdi      # imm = 0x100000000
xorl %ebx, %ebx
movq %r13, %r14
movq 0x18(%r13), %r13
cmpl $-0x1, 0x8(%r14)
je 0x360f9
testq %r15, %r15
je 0x36189
movq %r14, 0x18(%r15)
jmp 0x3618c
testq %r13, %r13
je 0x36112
cmpl $-0x1, 0x8(%r13)
jne 0x36112
movq (%r13), %rax
cmpb $0x5b, (%rax)
je 0x361f9
movq (%r14), %rax
movb (%rax), %al
movzbl %al, %ecx
cmpl $0x2b, %ecx
jle 0x3619d
cmpl $0x2c, %ecx
je 0x36206
cmpl $0x5b, %ecx
je 0x361f9
cmpl $0x5d, %ecx
jne 0x36244
cmpl $-0x1, %r12d
je 0x36404
movslq %r12d, %rax
movq %rax, %rbp
imulq %rsi, %rbp
addl $-0x2, %r12d
movq 0x10(%rsp,%rax,8), %rcx
movq (%rcx), %rdx
cmpb $0x5b, (%rdx)
je 0x36338
movq %rcx, %rdx
testq %r15, %r15
je 0x36172
movq %rcx, 0x18(%r15)
movq %rbx, %rdx
addq %rdi, %rbp
decl %r12d
movq %rcx, %r15
movq %rdx, %rbx
addq $-0x1, %rax
jb 0x36152
jmp 0x36404
movq %r14, %rbx
movq %r14, %r15
testq %r13, %r13
jne 0x360d9
jmp 0x36423
cmpl $0x28, %ecx
je 0x361f9
cmpl $0x29, %ecx
jne 0x36244
cmpl $-0x1, %r12d
je 0x36404
movslq %r12d, %rax
movq %rax, %rbp
shlq $0x20, %rbp
decl %r12d
movq 0x10(%rsp,%rax,8), %rcx
movq (%rcx), %rdx
cmpb $0x28, (%rdx)
je 0x36374
movq %rcx, %rdx
testq %r15, %r15
je 0x361e2
movq %rcx, 0x18(%r15)
movq %rbx, %rdx
addq %rsi, %rbp
decl %r12d
movq %rcx, %r15
movq %rdx, %rbx
addq $-0x1, %rax
jb 0x361c2
jmp 0x36404
movslq %r12d, %rax
incl %r12d
movq %r14, 0x18(%rsp,%rax,8)
jmp 0x3618f
cmpl $-0x1, %r12d
je 0x36404
movslq %r12d, %r12
movq 0x10(%rsp,%r12,8), %rax
movq (%rax), %rcx
cmpb $0x5b, (%rcx)
je 0x36330
movq %rax, %rcx
testq %r15, %r15
je 0x36233
movq %rax, 0x18(%r15)
movq %rbx, %rcx
movq %rax, %r15
movq %rcx, %rbx
addq $-0x1, %r12
jb 0x36213
jmp 0x36404
movsbl %al, %edi
leaq 0x9eb7f(%rip), %rsi     # 0xd4dcd
movl $0x7, %edx
callq 0x3b438
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x3639f
cmpl $-0x1, %r12d
je 0x363ab
movslq %r12d, %rbp
movq 0x10(%rsp,%rbp,8), %rax
movq (%rax), %rax
movsbl (%rax), %edi
leaq 0x9eb49(%rip), %rsi     # 0xd4dcd
movl $0x7, %edx
callq 0x3b438
cmpl $-0x1, %eax
je 0x363b1
movabsq $0x100000000, %rdi      # imm = 0x100000000
movl 0xc(%rsp), %r8d
movl %r8d, %edx
xorl $0x3, %edx
movl %r8d, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
setne %cl
movl %eax, %esi
xorl $0x2, %esi
orl %edx, %esi
setne %dl
cmpl %r8d, %eax
jge 0x362d2
testb %cl, %cl
je 0x362d2
testb %dl, %dl
jne 0x363d2
movq 0x10(%rsp,%rbp,8), %rcx
movq %rcx, %r12
testq %r15, %r15
je 0x362e6
movq %rcx, 0x18(%r15)
movq %rbx, %r12
subq $0x1, %rbp
jb 0x363da
movq 0x10(%rsp,%rbp,8), %rax
movq (%rax), %rax
movsbl (%rax), %edi
leaq 0x9eacb(%rip), %rsi     # 0xd4dcd
movl $0x7, %edx
movq %rcx, %rbx
callq 0x3b438
movq %rbx, %rcx
movabsq $0x100000000, %rdi      # imm = 0x100000000
movq %rbx, %r15
movq %r12, %rbx
cmpl $-0x1, %eax
jne 0x362a1
jmp 0x363e1
movq %r14, %rdi
movq %rsi, %r14
jmp 0x36388
movq %r14, %rdi
movq %rsi, %r14
callq 0x35d71
movq %rbp, %rax
negq %rax
sarq $0x1d, %rax
movq 0x10(%rsp,%rax), %rdi
callq 0x35d71
movq %r14, %rsi
movq %r14, %rax
subq %rbp, %rax
sarq $0x1d, %rax
movq 0x10(%rsp,%rax), %rax
testq %r15, %r15
je 0x363bd
movq %rax, 0x18(%r15)
jmp 0x363c0
movq %r14, %rdi
movq %rsi, %r14
callq 0x35d71
sarq $0x1d, %rbp
movq 0x10(%rsp,%rbp), %rdi
callq 0x35d71
movabsq $0x100000000, %rdi      # imm = 0x100000000
movq %r14, %rsi
jmp 0x3618f
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
jmp 0x363c3
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movabsq $0x100000000, %rdi      # imm = 0x100000000
jmp 0x363ea
movq %rax, %rbx
movq %rax, %r15
movabsq $0x100000000, %rdi      # imm = 0x100000000
jmp 0x3618f
movq %rbx, %r12
movq %r15, %rcx
jmp 0x363e1
movq $-0x1, %rbp
movq %r12, %rbx
movl %ebp, %r12d
movq %rcx, %r15
movslq %r12d, %rax
incl %r12d
movq %r14, 0x18(%rsp,%rax,8)
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
jmp 0x3618f
movq %r14, %rdi
callq 0x35d71
xorl %eax, %eax
addq $0x1f58, %rsp           # imm = 0x1F58
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
cmpl $-0x1, %r12d
je 0x3644e
movslq %r12d, %rcx
movq 0x10(%rsp,%rcx,8), %rdx
movq %rdx, %rax
testq %r15, %r15
je 0x36440
movq %rdx, 0x18(%r15)
movq %rbx, %rax
movq %rdx, %r15
movq %rax, %rbx
addq $-0x1, %rcx
jb 0x3642c
jmp 0x36454
movq %rbx, %rax
movq %r15, %rdx
testq %rdx, %rdx
je 0x3640e
movq $0x0, 0x18(%rdx)
jmp 0x3640e