// File: /workspace/github_cpp_makefile_star2_O1/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 0x22b66
movq %rdi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x10, %rax
ja 0x22b70
movq %rsi, %r14
leaq 0x10aa6(%rip), %rcx     # 0x33430
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x30(%rbx), %rdi
jmp 0x22a5f
movq 0x10(%rbx), %rdi
leaq 0x1(%r14), %rsi
callq 0x12800
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x12bb0
jmp 0x22b36
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12e20
jmp 0x22b36
movq 0x20(%rbx), %rax
movq (%rax), %r12
movq 0x8(%rax), %r13
cmpq %r13, %r12
je 0x22b36
leaq 0x1(%r14), %r15
movq (%r12), %rdi
movq %r15, %rsi
callq 0x12800
addq $0x8, %r12
cmpq %r13, %r12
jne 0x229e2
jmp 0x22b36
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x12540
jmp 0x22b36
movsd 0x48(%rbx), %xmm0
movq %r14, %rdi
callq 0x13220
jmp 0x22b36
leaq 0x4a06(%rip), %rdi      # 0x2742c
movq %r14, %rsi
callq 0x13090
movq 0x50(%rbx), %rdi
leaq 0x1(%r14), %r15
movq %r15, %rsi
callq 0x12bb0
leaq 0x60(%rbx), %rdi
movq %r15, %rsi
callq 0x131f0
jmp 0x22b36
leaq 0x10ad3(%rip), %rdi     # 0x33529
jmp 0x22a5f
leaq 0x10ce6(%rip), %rdi     # 0x33745
movq %r14, %rsi
callq 0x13090
jmp 0x22b36
leaq 0x47cf(%rip), %rdi      # 0x27242
movq %r14, %rsi
callq 0x13090
leaq 0x60(%rbx), %rdi
leaq 0x1(%r14), %r15
movq %r15, %rsi
callq 0x131f0
jmp 0x22aac
leaq 0x47b6(%rip), %rdi      # 0x2724a
movq %r14, %rsi
callq 0x13090
leaq 0x68(%rbx), %rdi
leaq 0x1(%r14), %r15
movq %r15, %rsi
callq 0x12fa0
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x12800
jmp 0x22b36
movq 0x30(%rbx), %rdi
movq %r14, %rsi
callq 0x13090
movq 0x20(%rbx), %rax
movq (%rax), %r12
movq 0x8(%rax), %r13
cmpq %r13, %r12
je 0x22aef
leaq 0x1(%r14), %r15
movq (%r12), %rdi
movq %r15, %rsi
callq 0x12800
addq $0x8, %r12
cmpq %r13, %r12
jne 0x22ada
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x22b36
leaq 0x1(%r14), %rsi
callq 0x12e60
jmp 0x22b36
movq 0x30(%rbx), %rdi
movq %r14, %rsi
callq 0x13090
cmpq $0x0, 0x38(%rbx)
je 0x22b36
leaq 0x1(%r14), %rsi
leaq 0x10a07(%rip), %rdi     # 0x3352b
callq 0x13090
movq 0x38(%rbx), %rdi
leaq 0x2(%r14), %rsi
jmp 0x22a62
cmpq $0x0, 0x40(%rbx)
je 0x22b66
leaq 0x1(%r14), %rsi
leaq 0x109d6(%rip), %rdi     # 0x3351e
callq 0x13090
movq 0x40(%rbx), %rdi
addq $0x2, %r14
movq %r14, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x13090
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x18479(%rip), %r14     # 0x3aff0
leaq 0x109b4(%rip), %rsi     # 0x33532
movl $0x1d, %edx
movq %r14, %rdi
callq 0x12a70
movl 0x8(%rbx), %esi
movq %r14, %rdi
callq 0x13080
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x128c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x12060
movq %rax, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x125d0