// File: /workspace/github_cpp_makefile_star2_O2/hyrise[P]sql-parser/src/util/sqlhelper.cpp
// Function: hsql::printExpression(hsql::Expr*, unsigned long)
void printExpression(Expr* expr, uintmax_t num_indent) {
  if (!expr) return;
  switch (expr->type) {
    case kExprStar:
      inprint("*", num_indent);
      break;
    case kExprColumnRef:
      inprint(expr->name, num_indent);
      if (expr->table) {
        inprint("Table:", num_indent + 1);
        inprint(expr->table, num_indent + 2);
      }
      break;
    // case kExprTableColumnRef: inprint(expr->table, expr->name, num_indent); break;
    case kExprLiteralFloat:
      inprint(expr->fval, num_indent);
      break;
    case kExprLiteralInt:
      inprint(expr->ival, num_indent);
      break;
    case kExprLiteralString:
      inprint(expr->name, num_indent);
      break;
    case kExprLiteralDate:
      inprint(expr->name, num_indent);
      break;
    case kExprLiteralNull:
      inprint("NULL", num_indent);
      break;
    case kExprLiteralInterval:
      inprint("INTERVAL", num_indent);
      inprint(expr->ival, num_indent + 1);
      inprint(expr->datetimeField, num_indent + 1);
      break;
    case kExprFunctionRef:
      inprint(expr->name, num_indent);
      for (Expr* e : *expr->exprList) {
        printExpression(e, num_indent + 1);
      }

      if (expr->windowDescription) {
        printWindowDescription(expr->windowDescription, num_indent + 1);
      }
      break;
    case kExprExtract:
      inprint("EXTRACT", num_indent);
      inprint(expr->datetimeField, num_indent + 1);
      printExpression(expr->expr, num_indent + 1);
      break;
    case kExprCast:
      inprint("CAST", num_indent);
      inprint(expr->columnType, num_indent + 1);
      printExpression(expr->expr, num_indent + 1);
      break;
    case kExprOperator:
      printOperatorExpression(expr, num_indent);
      break;
    case kExprSelect:
      printSelectStatementInfo(expr->select, num_indent);
      break;
    case kExprParameter:
      inprint(expr->ival, num_indent);
      break;
    case kExprArray:
      for (Expr* e : *expr->exprList) {
        printExpression(e, num_indent + 1);
      }
      break;
    case kExprArrayIndex:
      printExpression(expr->expr, num_indent + 1);
      inprint(expr->ival, num_indent);
      break;
    default:
      std::cerr << "Unrecognized expression type " << expr->type << std::endl;
      return;
  }
  if (expr->alias) {
    inprint("Alias", num_indent + 1);
    inprint(expr->alias, num_indent + 2);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x251e1
movq %rdi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x10, %rax
ja 0x251eb
movq %rsi, %r14
leaq 0x1140f(%rip), %rcx     # 0x36420
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x30(%rbx), %rdi
jmp 0x250de
movq 0x10(%rbx), %rdi
leaq 0x1(%r14), %rsi
callq 0x16b20
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x17080
jmp 0x251b1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x17410
jmp 0x251b1
movq 0x20(%rbx), %rax
movq (%rax), %r12
movq 0x8(%rax), %r13
leaq 0x1(%r14), %r15
cmpq %r13, %r12
je 0x251b1
movq (%r12), %rdi
movq %r15, %rsi
callq 0x16b20
addq $0x8, %r12
jmp 0x25060
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x16780
jmp 0x251b1
movsd 0x48(%rbx), %xmm0
movq %r14, %rdi
callq 0x178d0
jmp 0x251b1
leaq 0x5387(%rip), %rdi      # 0x2a42c
movq %r14, %rsi
callq 0x17700
movq 0x50(%rbx), %rdi
leaq 0x1(%r14), %r15
movq %r15, %rsi
callq 0x17080
leaq 0x60(%rbx), %rdi
movq %r15, %rsi
callq 0x178a0
jmp 0x251b1
leaq 0x11438(%rip), %rdi     # 0x3650d
jmp 0x250de
leaq 0x1164b(%rip), %rdi     # 0x36729
movq %r14, %rsi
callq 0x17700
jmp 0x251b1
leaq 0x5150(%rip), %rdi      # 0x2a242
movq %r14, %rsi
callq 0x17700
leaq 0x60(%rbx), %rdi
leaq 0x1(%r14), %r15
movq %r15, %rsi
callq 0x178a0
jmp 0x2512b
leaq 0x5137(%rip), %rdi      # 0x2a24a
movq %r14, %rsi
callq 0x17700
leaq 0x68(%rbx), %rdi
leaq 0x1(%r14), %r15
movq %r15, %rsi
callq 0x175e0
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x16b20
jmp 0x251b1
movq 0x30(%rbx), %rdi
movq %r14, %rsi
callq 0x17700
movq 0x20(%rbx), %rax
movq (%rax), %r12
movq 0x8(%rax), %r13
leaq 0x1(%r14), %r15
cmpq %r13, %r12
je 0x2516b
movq (%r12), %rdi
movq %r15, %rsi
callq 0x16b20
addq $0x8, %r12
jmp 0x25154
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x251b1
movq %r15, %rsi
callq 0x17450
jmp 0x251b1
movq 0x30(%rbx), %rdi
movq %r14, %rsi
callq 0x17700
cmpq $0x0, 0x38(%rbx)
je 0x251b1
leaq 0x1(%r14), %rsi
leaq 0x11370(%rip), %rdi     # 0x3650f
callq 0x17700
movq 0x38(%rbx), %rdi
leaq 0x2(%r14), %rsi
jmp 0x250e1
cmpq $0x0, 0x40(%rbx)
je 0x251e1
leaq 0x1(%r14), %rsi
leaq 0x1133f(%rip), %rdi     # 0x36502
callq 0x17700
movq 0x40(%rbx), %rdi
addq $0x2, %r14
movq %r14, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x17700
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x19df6(%rip), %rdi     # 0x3efe8
leaq 0x1131d(%rip), %rsi     # 0x36516
callq 0x16d00
movl 0x8(%rbx), %esi
movq %rax, %rdi
callq 0x176f0
movq %rax, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x16540