// File: hyrise[P]sql-parser/src/util/sqlhelper.cpp
// Function: hsql::operator<<(std::ostream&, hsql::DatetimeField const&)
std::ostream& operator<<(std::ostream& os, const DatetimeField& datetime) {
  static const std::map<const DatetimeField, const std::string> operatorToToken = {
      {kDatetimeNone, "None"}, {kDatetimeSecond, "SECOND"}, {kDatetimeMinute, "MINUTE"}, {kDatetimeHour, "HOUR"},
      {kDatetimeDay, "DAY"},   {kDatetimeMonth, "MONTH"},   {kDatetimeYear, "YEAR"}};

  const auto found = operatorToToken.find(datetime);
  if (found == operatorToToken.cend()) {
    return os << static_cast<uint64_t>(datetime);
  } else {
    return os << (*found).second;
  }
}

// Assembly:
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, 0x1c8(%rsp)
movq %rsi, 0x1c0(%rsp)
cmpb $0x0, 0x2649a(%rip)     # 0x8fac8
jne 0x6983e
leaq 0x2648d(%rip), %rdi     # 0x8fac8
callq 0x39c30
cmpl $0x0, %eax
je 0x6983e
leaq 0x98(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x0, 0x8c(%rsp)
leaq 0x153d6(%rip), %rdx     # 0x7ea41
leaq 0x8c(%rsp), %rsi
callq 0x37740
jmp 0x6967a
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x1, 0x78(%rsp)
leaq 0x90a9(%rip), %rdx      # 0x72742
leaq 0x78(%rsp), %rsi
callq 0x39dc0
jmp 0x696a5
leaq 0xe8(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x2, 0x74(%rsp)
leaq 0x9085(%rip), %rdx      # 0x72749
leaq 0x74(%rsp), %rsi
callq 0x39dc0
jmp 0x696d0
leaq 0x110(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x3, 0x70(%rsp)
leaq 0x9061(%rip), %rdx      # 0x72750
leaq 0x70(%rsp), %rsi
callq 0x37740
jmp 0x696fb
leaq 0x138(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x4, 0x6c(%rsp)
leaq 0x903b(%rip), %rdx      # 0x72755
leaq 0x6c(%rsp), %rsi
callq 0x39250
jmp 0x69726
leaq 0x160(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x5, 0x68(%rsp)
leaq 0x9014(%rip), %rdx      # 0x72759
leaq 0x68(%rsp), %rsi
callq 0x358f0
jmp 0x69751
leaq 0x188(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x6, 0x64(%rsp)
leaq 0x8fef(%rip), %rdx      # 0x7275f
leaq 0x64(%rsp), %rsi
callq 0x37740
jmp 0x6977c
leaq 0x98(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movq $0x7, 0x1b8(%rsp)
leaq 0x62(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x39a00
movq 0x48(%rsp), %r8
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
leaq 0x262d5(%rip), %rdi     # 0x8fa98
leaq 0x63(%rsp), %rcx
callq 0x38610
jmp 0x697cf
leaq 0x62(%rsp), %rdi
callq 0x371a0
leaq 0x98(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x118, %rax            # imm = 0x118
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x30(%rsp)
callq 0x36a10
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x40(%rsp)
jne 0x697f1
movq 0x23759(%rip), %rdi     # 0x8cf78
leaq 0x26272(%rip), %rsi     # 0x8fa98
leaq 0x261bb(%rip), %rdx     # 0x8f9e8
callq 0x37270
leaq 0x2628f(%rip), %rdi     # 0x8fac8
callq 0x36790
movq 0x1c0(%rsp), %rsi
leaq 0x2624b(%rip), %rdi     # 0x8fa98
callq 0x37d70
movq %rax, 0x58(%rsp)
leaq 0x2623a(%rip), %rdi     # 0x8fa98
callq 0x38070
movq %rax, 0x50(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x35a30
testb $0x1, %al
jne 0x69880
jmp 0x69967
movq 0x1c8(%rsp), %rdi
movq 0x1c0(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x35760
movq %rax, 0x1d0(%rsp)
jmp 0x69995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
movq 0x90(%rsp), %rax
leaq 0x98(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x28(%rsp)
je 0x698fb
movq 0x28(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x20(%rsp)
callq 0x36a10
movq 0x20(%rsp), %rax
leaq 0x98(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x28(%rsp)
jne 0x698d1
jmp 0x69959
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x62(%rsp), %rdi
callq 0x371a0
leaq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
addq $0x118, %rax            # imm = 0x118
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x8(%rsp)
callq 0x36a10
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x18(%rsp)
jne 0x69930
jmp 0x69959
leaq 0x26168(%rip), %rdi     # 0x8fac8
callq 0x36720
jmp 0x699a5
movq 0x1c8(%rsp), %rax
movq %rax, (%rsp)
leaq 0x58(%rsp), %rdi
callq 0x3a100
movq (%rsp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x372a0
movq %rax, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rax
addq $0x1d8, %rsp            # imm = 0x1D8
retq
movq 0x80(%rsp), %rdi
callq 0x399c0
nopw %cs:(%rax,%rax)