// File: /workspace/github_cpp_makefile_star2_O3/hyrise[P]sql-parser/src/util/sqlhelper.cpp
// Function: hsql::printSelectStatementInfo(hsql::SelectStatement const*, unsigned long)
void printSelectStatementInfo(const SelectStatement* stmt, uintmax_t num_indent) {
  inprint("SelectStatement", num_indent);
  inprint("Fields:", num_indent + 1);
  for (Expr* expr : *stmt->selectList) printExpression(expr, num_indent + 2);

  if (stmt->fromTable) {
    inprint("Sources:", num_indent + 1);
    printTableRefInfo(stmt->fromTable, num_indent + 2);
  }

  if (stmt->whereClause) {
    inprint("Search Conditions:", num_indent + 1);
    printExpression(stmt->whereClause, num_indent + 2);
  }

  if (stmt->groupBy) {
    inprint("GroupBy:", num_indent + 1);
    for (Expr* expr : *stmt->groupBy->columns) printExpression(expr, num_indent + 2);
    if (stmt->groupBy->having) {
      inprint("Having:", num_indent + 1);
      printExpression(stmt->groupBy->having, num_indent + 2);
    }
  }
  if (stmt->lockings) {
    inprint("Lock Info:", num_indent + 1);
    for (LockingClause* lockingClause : *stmt->lockings) {
      inprint("Type", num_indent + 2);
      if (lockingClause->rowLockMode == RowLockMode::ForUpdate) {
        inprint("FOR UPDATE", num_indent + 3);
      } else if (lockingClause->rowLockMode == RowLockMode::ForNoKeyUpdate) {
        inprint("FOR NO KEY UPDATE", num_indent + 3);
      } else if (lockingClause->rowLockMode == RowLockMode::ForShare) {
        inprint("FOR SHARE", num_indent + 3);
      } else if (lockingClause->rowLockMode == RowLockMode::ForKeyShare) {
        inprint("FOR KEY SHARE", num_indent + 3);
      }
      if (lockingClause->tables) {
        inprint("Target tables:", num_indent + 2);
        for (char* dtable : *lockingClause->tables) {
          inprint(dtable, num_indent + 3);
        }
      }
      if (lockingClause->rowLockWaitPolicy != RowLockWaitPolicy::None) {
        inprint("Waiting policy: ", num_indent + 2);
        if (lockingClause->rowLockWaitPolicy == RowLockWaitPolicy::NoWait)
          inprint("NOWAIT", num_indent + 3);
        else
          inprint("SKIP LOCKED", num_indent + 3);
      }
    }
  }

  if (stmt->setOperations) {
    for (SetOperation* setOperation : *stmt->setOperations) {
      switch (setOperation->setType) {
        case SetType::kSetIntersect:
          inprint("Intersect:", num_indent + 1);
          break;
        case SetType::kSetUnion:
          inprint("Union:", num_indent + 1);
          break;
        case SetType::kSetExcept:
          inprint("Except:", num_indent + 1);
          break;
      }

      printSelectStatementInfo(setOperation->nestedSelectStatement, num_indent + 2);

      if (setOperation->resultOrder) {
        inprint("SetResultOrderBy:", num_indent + 1);
        printOrderBy(setOperation->resultOrder, num_indent + 2);
      }

      if (setOperation->resultLimit) {
        if (setOperation->resultLimit->limit) {
          inprint("SetResultLimit:", num_indent + 1);
          printExpression(setOperation->resultLimit->limit, num_indent + 2);
        }

        if (setOperation->resultLimit->offset) {
          inprint("SetResultOffset:", num_indent + 1);
          printExpression(setOperation->resultLimit->offset, num_indent + 2);
        }
      }
    }
  }

  if (stmt->order) {
    inprint("OrderBy:", num_indent + 1);
    printOrderBy(stmt->order, num_indent + 2);
  }

  if (stmt->limit && stmt->limit->limit) {
    inprint("Limit:", num_indent + 1);
    printExpression(stmt->limit->limit, num_indent + 2);
  }

  if (stmt->limit && stmt->limit->offset) {
    inprint("Offset:", num_indent + 1);
    printExpression(stmt->limit->offset, num_indent + 2);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r13
leaq 0x11115(%rip), %rdi     # 0x3358b
callq 0x13090
leaq 0x1(%r15), %rsi
leaq 0x11115(%rip), %rdi     # 0x3359b
movq %rsi, 0x8(%rsp)
callq 0x13090
movq 0x30(%r13), %rax
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x224b8
leaq 0x2(%r15), %rbx
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x12800
addq $0x8, %r14
cmpq %r12, %r14
jne 0x224a4
cmpq $0x0, 0x20(%r13)
je 0x224dd
leaq 0x110dd(%rip), %rdi     # 0x335a3
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x20(%r13), %rdi
leaq 0x2(%r15), %rsi
callq 0x12c10
cmpq $0x0, 0x38(%r13)
je 0x22502
leaq 0x110c1(%rip), %rdi     # 0x335ac
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x38(%r13), %rdi
leaq 0x2(%r15), %rsi
callq 0x12800
cmpq $0x0, 0x40(%r13)
je 0x22573
leaq 0x110af(%rip), %rdi     # 0x335bf
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x40(%r13), %rax
movq 0x8(%rax), %rcx
movq (%rcx), %r14
movq 0x8(%rcx), %r12
cmpq %r12, %r14
je 0x2254a
leaq 0x2(%r15), %rbx
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x12800
addq $0x8, %r14
cmpq %r12, %r14
jne 0x22532
movq 0x40(%r13), %rax
cmpq $0x0, 0x10(%rax)
je 0x22573
leaq 0x11070(%rip), %rdi     # 0x335c8
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x40(%r13), %rax
movq 0x10(%rax), %rdi
leaq 0x2(%r15), %rsi
callq 0x12800
movq %r15, 0x10(%rsp)
movq %r13, 0x18(%rsp)
cmpq $0x0, 0x68(%r13)
je 0x22671
leaq 0x11041(%rip), %rdi     # 0x335d0
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x18(%rsp), %rax
movq 0x68(%rax), %rax
movq (%rax), %r14
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
cmpq %rax, %r14
je 0x22671
movq 0x10(%rsp), %rax
leaq 0x2(%rax), %rbx
leaq 0x3(%rax), %r12
movq (%r14), %r13
leaq 0x1100d(%rip), %rdi     # 0x335db
movq %rbx, %rsi
callq 0x13090
movl (%r13), %eax
cmpq $0x3, %rax
ja 0x225f6
leaq 0x10eb5(%rip), %rcx     # 0x3349c
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
movq %r12, %rsi
callq 0x13090
cmpq $0x0, 0x8(%r13)
je 0x2262d
leaq 0x11011(%rip), %rdi     # 0x33615
movq %rbx, %rsi
callq 0x13090
movq 0x8(%r13), %rax
movq (%rax), %r15
movq 0x8(%rax), %rbp
cmpq %rbp, %r15
je 0x2262d
movq (%r15), %rdi
movq %r12, %rsi
callq 0x13090
addq $0x8, %r15
jmp 0x22617
cmpl $0x2, 0x4(%r13)
je 0x22662
leaq 0x10fe9(%rip), %rdi     # 0x33624
movq %rbx, %rsi
callq 0x13090
cmpl $0x0, 0x4(%r13)
leaq 0x10fe6(%rip), %rdi     # 0x33635
leaq 0x4e14(%rip), %rax      # 0x2746a
cmoveq %rax, %rdi
movq %r12, %rsi
callq 0x13090
addq $0x8, %r14
cmpq 0x20(%rsp), %r14
jne 0x225c4
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rax
testq %rax, %rax
je 0x2275e
movq (%rax), %r13
movq 0x8(%rax), %rbp
cmpq %rbp, %r13
je 0x2275e
movq 0x10(%rsp), %rax
leaq 0x2(%rax), %r12
leaq 0x10e09(%rip), %r14     # 0x334ac
leaq 0x10fd3(%rip), %r15     # 0x3367d
movq (%r13), %rbx
movl 0x8(%rbx), %eax
cmpq $0x2, %rax
ja 0x226c8
movslq (%r14,%rax,4), %rdi
addq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0x12540
cmpq $0x0, 0x18(%rbx)
je 0x226f8
leaq 0x10f79(%rip), %rdi     # 0x3365b
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x12e00
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x22751
cmpq $0x0, 0x8(%rax)
je 0x2272d
leaq 0x10f5e(%rip), %rdi     # 0x3366d
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x20(%rbx), %rax
movq 0x8(%rax), %rdi
movq %r12, %rsi
callq 0x12800
movq 0x20(%rbx), %rax
cmpq $0x0, 0x10(%rax)
je 0x22751
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x20(%rbx), %rax
movq 0x10(%rax), %rdi
movq %r12, %rsi
callq 0x12800
addq $0x8, %r13
cmpq %rbp, %r13
jne 0x226aa
movq 0x18(%rsp), %r14
cmpq $0x0, 0x50(%r14)
movq 0x10(%rsp), %rbx
je 0x2278d
leaq 0x10eee(%rip), %rdi     # 0x33664
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x50(%r14), %rdi
leaq 0x2(%rbx), %rsi
callq 0x12e00
movq 0x60(%r14), %rax
testq %rax, %rax
je 0x22802
cmpq $0x0, 0x8(%rax)
je 0x227c8
leaq 0x10ed2(%rip), %rdi     # 0x33676
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x60(%r14), %rax
movq 0x8(%rax), %rdi
leaq 0x2(%rbx), %rsi
callq 0x12800
movq 0x60(%r14), %rax
testq %rax, %rax
je 0x22802
cmpq $0x0, 0x10(%rax)
je 0x22802
leaq 0x10eb0(%rip), %rdi     # 0x33686
movq 0x8(%rsp), %rsi
callq 0x13090
movq 0x60(%r14), %rax
movq 0x10(%rax), %rdi
addq $0x2, %rbx
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12800
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq