// File: hyrise[P]sql-parser/src/sql/statements.cpp
// Function: hsql::SelectStatement::~SelectStatement()
SelectStatement::~SelectStatement() {
  delete fromTable;
  delete whereClause;
  delete groupBy;
  delete limit;

  // Delete each element in the select list.
  if (selectList) {
    for (Expr* expr : *selectList) {
      delete expr;
    }
    delete selectList;
  }

  if (order) {
    for (OrderDescription* desc : *order) {
      delete desc;
    }
    delete order;
  }

  if (withDescriptions) {
    for (WithDescription* desc : *withDescriptions) {
      delete desc;
    }
    delete withDescriptions;
  }

  if (setOperations) {
    for (SetOperation* setOperation : *setOperations) {
      delete setOperation;
    }
    delete setOperations;
  }

  if (lockings) {
    for (LockingClause* lockingClause : *lockings) {
      if (lockingClause->tables) {
        for (char* dtable : *lockingClause->tables) {
          free(dtable);
        }
        delete lockingClause->tables;
      }
      delete lockingClause;
    }
    delete lockings;
  }
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x140(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x256dd(%rip), %rcx     # 0x8ceb0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x20(%rax), %rax
movq %rax, 0x78(%rsp)
cmpq $0x0, %rax
je 0x677f4
movq 0x78(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x68(%rsp)
cmpq $0x0, %rax
je 0x67813
movq 0x68(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x70(%rsp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
je 0x67832
movq 0x60(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x70(%rsp), %rax
movq 0x60(%rax), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, %rax
je 0x67851
movq 0x58(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x70(%rsp), %rax
cmpq $0x0, 0x30(%rax)
je 0x6792d
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rdi
callq 0x36b30
movq %rax, 0x130(%rsp)
movq 0x138(%rsp), %rdi
callq 0x38740
movq %rax, 0x128(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x39fa0
testb $0x1, %al
jne 0x678b7
jmp 0x678fe
leaq 0x130(%rsp), %rdi
callq 0x37b30
movq (%rax), %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
je 0x678ed
movq 0x50(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x678ef
leaq 0x130(%rsp), %rdi
callq 0x36f80
jmp 0x6789c
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, %rax
je 0x6792b
movq 0x48(%rsp), %rdi
callq 0x39690
movq 0x48(%rsp), %rdi
movl $0x18, %esi
callq 0x378a0
jmp 0x6792d
movq 0x70(%rsp), %rax
cmpq $0x0, 0x50(%rax)
je 0x67a09
movq 0x70(%rsp), %rax
movq 0x50(%rax), %rax
movq %rax, 0x118(%rsp)
movq 0x118(%rsp), %rdi
callq 0x38350
movq %rax, 0x110(%rsp)
movq 0x118(%rsp), %rdi
callq 0x35890
movq %rax, 0x108(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x35d50
testb $0x1, %al
jne 0x67993
jmp 0x679da
leaq 0x110(%rsp), %rdi
callq 0x39680
movq (%rax), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x679c9
movq 0x40(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x679cb
leaq 0x110(%rsp), %rdi
callq 0x3a0b0
jmp 0x67978
movq 0x70(%rsp), %rax
movq 0x50(%rax), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x67a07
movq 0x38(%rsp), %rdi
callq 0x36990
movq 0x38(%rsp), %rdi
movl $0x18, %esi
callq 0x378a0
jmp 0x67a09
movq 0x70(%rsp), %rax
cmpq $0x0, 0x58(%rax)
je 0x67af3
movq 0x70(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x363f0
movq %rax, 0xf0(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x38e80
movq %rax, 0xe8(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x371c0
testb $0x1, %al
jne 0x67a6f
jmp 0x67ac4
leaq 0xf0(%rsp), %rdi
callq 0x36e80
movq (%rax), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x67ab3
movq 0x30(%rsp), %rdi
callq 0x35100
movq 0x30(%rsp), %rdi
movl $0x10, %esi
callq 0x378a0
jmp 0x67ab5
leaq 0xf0(%rsp), %rdi
callq 0x36fe0
jmp 0x67a54
movq 0x70(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
je 0x67af1
movq 0x28(%rsp), %rdi
callq 0x398a0
movq 0x28(%rsp), %rdi
movl $0x18, %esi
callq 0x378a0
jmp 0x67af3
movq 0x70(%rsp), %rax
cmpq $0x0, 0x48(%rax)
je 0x67bcf
movq 0x70(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x35800
movq %rax, 0xd0(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x39d90
movq %rax, 0xc8(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x37d60
testb $0x1, %al
jne 0x67b59
jmp 0x67ba0
leaq 0xd0(%rsp), %rdi
callq 0x37190
movq (%rax), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x67b8f
movq 0x20(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x67b91
leaq 0xd0(%rsp), %rdi
callq 0x38730
jmp 0x67b3e
movq 0x70(%rsp), %rax
movq 0x48(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x67bcd
movq 0x18(%rsp), %rdi
callq 0x36710
movq 0x18(%rsp), %rdi
movl $0x18, %esi
callq 0x378a0
jmp 0x67bcf
movq 0x70(%rsp), %rax
cmpq $0x0, 0x68(%rax)
je 0x67d84
movq 0x70(%rsp), %rax
movq 0x68(%rax), %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x39150
movq %rax, 0xb0(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x36af0
movq %rax, 0xa8(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x35f70
testb $0x1, %al
jne 0x67c38
jmp 0x67d58
leaq 0xb0(%rsp), %rdi
callq 0x38f80
movq (%rax), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x67d22
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rdi
callq 0x37d80
movq %rax, 0x90(%rsp)
movq 0x98(%rsp), %rdi
callq 0x399b0
movq %rax, 0x88(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x392c0
testb $0x1, %al
jne 0x67cbc
jmp 0x67cf0
leaq 0x90(%rsp), %rdi
callq 0x38ff0
movq (%rax), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x38090
leaq 0x90(%rsp), %rdi
callq 0x36eb0
jmp 0x67ca1
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x67d20
movq 0x10(%rsp), %rdi
callq 0x37bf0
movq 0x10(%rsp), %rdi
movl $0x18, %esi
callq 0x378a0
jmp 0x67d22
movq 0xa0(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x67d44
movq 0x8(%rsp), %rdi
movl $0x10, %esi
callq 0x378a0
jmp 0x67d46
leaq 0xb0(%rsp), %rdi
callq 0x377f0
jmp 0x67c1a
movq 0x70(%rsp), %rax
movq 0x68(%rax), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x67d82
movq (%rsp), %rdi
callq 0x374f0
movq (%rsp), %rdi
movl $0x18, %esi
callq 0x378a0
jmp 0x67d84
movq 0x70(%rsp), %rdi
callq 0x38650
addq $0x148, %rsp            # imm = 0x148
retq
nopw %cs:(%rax,%rax)