// File: navrajsaini[P]PL_Compiler_design_project/parser.cpp
// Function: Parse::ProcDef()
void Parse::ProcDef()//procedure definition
{where="PD";check();
   if(LHS=="proc")
   {
      match();
      ProcName();
      eKind = PROCEDURE;
      int procLabel = newLabel();
      // add to current block 
      if(!checkDef(procLabel))
	 scopeError("Ambiguous definition of Procedure");
      //add to block stack
      if(!bTable.newBlock())
	 scopeError("Exceded Block limit while declaring procedure");
      //

      varLabel = newLabel();
      startLabel = newLabel();  
      gen.emit2("DEFADDR", procLabel);
      gen.emit3("PROC", varLabel, startLabel);
      //***
      valLenPtr++;
      valLength[valLenPtr] = 0;
      currentLevel++;
      Block();
      valLenPtr--;
      levelOfCurrentBlock[currentLevel] = 3;
      currentLevel--;
      //remove block from stack
      printPop();
      bTable.endBlock();
      gen.emit1("ENDPROC");
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
addq $0x5098, %rdi           # imm = 0x5098
leaq 0x9212(%rip), %rsi      # 0x1f8ba
callq 0x2280
movq -0xf0(%rbp), %rdi
callq 0x15310
movq -0xf0(%rbp), %rdi
addq $0x5050, %rdi           # imm = 0x5050
leaq 0x895e(%rip), %rsi      # 0x1f02c
callq 0x10ea0
testb $0x1, %al
jne 0x166dc
jmp 0x16af3
movq -0xf0(%rbp), %rdi
callq 0x14f20
movq -0xf0(%rbp), %rdi
callq 0x174f0
movq -0xf0(%rbp), %rdi
movl $0x3, 0x4dd8(%rdi)
callq 0x15e60
movq -0xf0(%rbp), %rdi
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %esi
callq 0x15600
testb $0x1, %al
jne 0x167a4
leaq -0x31(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x2350
movq -0xf8(%rbp), %rdx
leaq 0x917b(%rip), %rsi      # 0x1f8bd
leaq -0x30(%rbp), %rdi
callq 0x2290
jmp 0x1674d
movq -0xf0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x15400
jmp 0x1675f
leaq -0x30(%rbp), %rdi
callq 0x2130
leaq -0x31(%rbp), %rdi
callq 0x21e0
jmp 0x167a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x16796
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2130
leaq -0x31(%rbp), %rdi
callq 0x21e0
jmp 0x16afc
movq -0xf0(%rbp), %rdi
addq $0x4c38, %rdi           # imm = 0x4C38
callq 0x1a430
testb $0x1, %al
jne 0x1683f
leaq -0x69(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x2350
movq -0x100(%rbp), %rdx
leaq 0x9102(%rip), %rsi      # 0x1f8df
leaq -0x68(%rbp), %rdi
callq 0x2290
jmp 0x167e8
movq -0xf0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x15400
jmp 0x167fa
leaq -0x68(%rbp), %rdi
callq 0x2130
leaq -0x69(%rbp), %rdi
callq 0x21e0
jmp 0x1683f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x16831
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x2130
leaq -0x69(%rbp), %rdi
callq 0x21e0
jmp 0x16afc
movq -0xf0(%rbp), %rdi
callq 0x15e60
movq -0xf0(%rbp), %rdi
movl %eax, 0x71bc(%rdi)
callq 0x15e60
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x71c0(%rax)
addq $0x50c0, %rax           # imm = 0x50C0
movq %rax, -0x110(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x2350
movq -0x108(%rbp), %rdx
leaq 0x8f6c(%rip), %rsi      # 0x1f806
leaq -0x90(%rbp), %rdi
callq 0x2290
jmp 0x168a8
movq -0x110(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq -0x90(%rbp), %rsi
callq 0x12f70
jmp 0x168c0
leaq -0x90(%rbp), %rdi
callq 0x2130
leaq -0x91(%rbp), %rdi
callq 0x21e0
movq -0xf0(%rbp), %rax
addq $0x50c0, %rax           # imm = 0x50C0
movq %rax, -0x120(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x2350
movq -0x118(%rbp), %rdx
leaq 0x9003(%rip), %rsi      # 0x1f910
leaq -0xb8(%rbp), %rdi
callq 0x2290
jmp 0x1691b
movq -0x120(%rbp), %rdi
movq -0xf0(%rbp), %rax
movl 0x71bc(%rax), %edx
movl 0x71c0(%rax), %ecx
leaq -0xb8(%rbp), %rsi
callq 0x13010
jmp 0x16943
leaq -0xb8(%rbp), %rdi
callq 0x2130
leaq -0xb9(%rbp), %rdi
callq 0x21e0
movq -0xf0(%rbp), %rdi
movl 0x71ec(%rdi), %eax
incl %eax
movl %eax, 0x71ec(%rdi)
movslq 0x71ec(%rdi), %rax
movl $0x0, 0x71c4(%rdi,%rax,4)
movl 0x7224(%rdi), %eax
incl %eax
movl %eax, 0x7224(%rdi)
callq 0x15e90
movq -0xf0(%rbp), %rdi
movl 0x71ec(%rdi), %eax
decl %eax
movl %eax, 0x71ec(%rdi)
movslq 0x7224(%rdi), %rax
movl $0x3, 0x71fc(%rdi,%rax,4)
movl 0x7224(%rdi), %eax
decl %eax
movl %eax, 0x7224(%rdi)
callq 0x15ad0
movq -0xf0(%rbp), %rdi
addq $0x4c38, %rdi           # imm = 0x4C38
callq 0x1a480
movq -0xf0(%rbp), %rax
addq $0x50c0, %rax           # imm = 0x50C0
movq %rax, -0x130(%rbp)
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x2350
movq -0x128(%rbp), %rdx
leaq 0x8ef6(%rip), %rsi      # 0x1f90d
leaq -0xe0(%rbp), %rdi
callq 0x2290
jmp 0x16a25
movq -0x130(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x12ef0
jmp 0x16a3a
leaq -0xe0(%rbp), %rdi
callq 0x2130
leaq -0xe1(%rbp), %rdi
callq 0x21e0
jmp 0x16af3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x16a7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2130
leaq -0x91(%rbp), %rdi
callq 0x21e0
jmp 0x16afc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x16ab1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x2130
leaq -0xb9(%rbp), %rdi
callq 0x21e0
jmp 0x16afc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x16ae5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2130
leaq -0xe1(%rbp), %rdi
callq 0x21e0
jmp 0x16afc
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)