// File: /workspace/github_cpp_makefile_star2_O2/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 $0x18, %rsp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x118e7(%rip), %rdi     # 0x3656f
callq 0x17700
leaq 0x1(%r12), %r14
leaq 0x118e6(%rip), %rdi     # 0x3657f
movq %r14, %rsi
callq 0x17700
movq %rbx, (%rsp)
movq 0x30(%rbx), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r13
leaq 0x2(%r12), %r15
cmpq %r13, %rbx
je 0x24ccb
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x16b20
addq $0x8, %rbx
jmp 0x24cb5
movq (%rsp), %rbx
cmpq $0x0, 0x20(%rbx)
je 0x24cf1
leaq 0x118aa(%rip), %rdi     # 0x36587
movq %r14, %rsi
callq 0x17700
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x17120
cmpq $0x0, 0x38(%rbx)
je 0x24d13
leaq 0x11891(%rip), %rdi     # 0x36590
movq %r14, %rsi
callq 0x17700
movq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x16b20
cmpq $0x0, 0x40(%rbx)
movq %r14, 0x8(%rsp)
je 0x24d86
leaq 0x1187d(%rip), %rdi     # 0x365a3
movq %r14, %rsi
callq 0x17700
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r14
cmpq %r14, %rbx
je 0x24d53
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x16b20
addq $0x8, %rbx
jmp 0x24d3d
movq (%rsp), %rbx
movq 0x40(%rbx), %rax
cmpq $0x0, 0x10(%rax)
movq 0x8(%rsp), %r14
je 0x24d86
leaq 0x1183e(%rip), %rdi     # 0x365ac
movq %r14, %rsi
callq 0x17700
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
callq 0x16b20
cmpq $0x0, 0x68(%rbx)
je 0x24e70
leaq 0x1181c(%rip), %rdi     # 0x365b4
movq %r14, %rsi
callq 0x17700
movq (%rsp), %rax
movq 0x68(%rax), %rax
movq (%rax), %rbp
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
addq $0x3, %r12
cmpq 0x10(%rsp), %rbp
je 0x24e70
movq (%rbp), %r13
leaq 0x117f1(%rip), %rdi     # 0x365bf
movq %r15, %rsi
callq 0x17700
movl (%r13), %eax
cmpq $0x3, %rax
ja 0x24df6
leaq 0x116b5(%rip), %rcx     # 0x3649c
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
movq %r12, %rsi
callq 0x17700
cmpq $0x0, 0x8(%r13)
je 0x24e2d
leaq 0x117f5(%rip), %rdi     # 0x365f9
movq %r15, %rsi
callq 0x17700
movq 0x8(%r13), %rax
movq (%rax), %r14
movq 0x8(%rax), %rbx
cmpq %rbx, %r14
je 0x24e2d
movq (%r14), %rdi
movq %r12, %rsi
callq 0x17700
addq $0x8, %r14
jmp 0x24e17
cmpl $0x2, 0x4(%r13)
je 0x24e62
leaq 0x117cd(%rip), %rdi     # 0x36608
movq %r15, %rsi
callq 0x17700
cmpl $0x0, 0x4(%r13)
leaq 0x117ca(%rip), %rdi     # 0x36619
leaq 0x5614(%rip), %rax      # 0x2a46a
cmoveq %rax, %rdi
movq %r12, %rsi
callq 0x17700
addq $0x8, %rbp
movq 0x8(%rsp), %r14
jmp 0x24db8
movq (%rsp), %rax
movq 0x48(%rax), %rax
testq %rax, %rax
je 0x24f44
movq (%rax), %rbx
movq 0x8(%rax), %r12
leaq 0x1161d(%rip), %r13     # 0x364ac
cmpq %r12, %rbx
je 0x24f44
movq (%rbx), %rbp
movl 0x8(%rbp), %eax
cmpq $0x2, %rax
ja 0x24eb4
movslq (%r13,%rax,4), %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0x17700
movq 0x10(%rbp), %rdi
movq %r15, %rsi
callq 0x16780
cmpq $0x0, 0x18(%rbp)
je 0x24ee2
leaq 0x11771(%rip), %rdi     # 0x3663f
movq %r14, %rsi
callq 0x17700
movq 0x18(%rbp), %rdi
movq %r15, %rsi
callq 0x173e0
movq 0x20(%rbp), %rax
testq %rax, %rax
je 0x24f3b
cmpq $0x0, 0x8(%rax)
je 0x24f15
leaq 0x11758(%rip), %rdi     # 0x36651
movq %r14, %rsi
callq 0x17700
movq 0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq %r15, %rsi
callq 0x16b20
movq 0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x24f3b
leaq 0x1173e(%rip), %rdi     # 0x36661
movq %r14, %rsi
callq 0x17700
movq 0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
callq 0x16b20
addq $0x8, %rbx
jmp 0x24e8f
movq (%rsp), %rbx
cmpq $0x0, 0x50(%rbx)
je 0x24f6a
leaq 0x116f2(%rip), %rdi     # 0x36648
movq %r14, %rsi
callq 0x17700
movq 0x50(%rbx), %rdi
movq %r15, %rsi
callq 0x173e0
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x24fd6
cmpq $0x0, 0x8(%rax)
je 0x24fa2
leaq 0x116d9(%rip), %rdi     # 0x3665a
movq %r14, %rsi
callq 0x17700
movq 0x60(%rbx), %rax
movq 0x8(%rax), %rdi
movq %r15, %rsi
callq 0x16b20
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x24fd6
cmpq $0x0, 0x10(%rax)
je 0x24fd6
leaq 0x116ba(%rip), %rdi     # 0x3666a
movq %r14, %rsi
callq 0x17700
movq 0x60(%rbx), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16b20
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq