// File: WeihuaZhu[P]hpc_prog2/./gtest/gtest-all.cc
// Function: testing::internal::CodePointToUtf8[abi:cxx11](unsigned int)
std::string CodePointToUtf8(UInt32 code_point) {
  if (code_point > kMaxCodePoint4) {
    return "(Invalid Unicode 0x" + String::FormatHexInt(code_point) + ")";
  }

  char str[5];  // Big enough for the largest valid code point.
  if (code_point <= kMaxCodePoint1) {
    str[1] = '\0';
    str[0] = static_cast<char>(code_point);                          // 0xxxxxxx
  } else if (code_point <= kMaxCodePoint2) {
    str[2] = '\0';
    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
    str[0] = static_cast<char>(0xC0 | code_point);                   // 110xxxxx
  } else if (code_point <= kMaxCodePoint3) {
    str[3] = '\0';
    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
    str[0] = static_cast<char>(0xE0 | code_point);                   // 1110xxxx
  } else {  // code_point <= kMaxCodePoint4
    str[4] = '\0';
    str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
    str[0] = static_cast<char>(0xF0 | code_point);                   // 11110xxx
  }
  return str;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x10(%rsp)
movq %rdi, %rax
movq %rax, 0x18(%rsp)
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
cmpl $0x1fffff, 0x7c(%rsp)   # imm = 0x1FFFFF
jbe 0x1c2c1
movl 0x7c(%rsp), %esi
leaq 0x38(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1c420
movq 0x8(%rsp), %rdx
leaq 0x308eb(%rip), %rsi     # 0x4cb38
leaq 0x58(%rsp), %rdi
callq 0x34590
jmp 0x1c259
movq 0x10(%rsp), %rdi
leaq 0x30d43(%rip), %rdx     # 0x4cfa8
leaq 0x58(%rsp), %rsi
callq 0x32c70
jmp 0x1c271
leaq 0x58(%rsp), %rdi
callq 0xf698
leaq 0x38(%rsp), %rdi
callq 0xf698
jmp 0x1c408
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x1c2b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
leaq 0x58(%rsp), %rdi
callq 0xf698
leaq 0x38(%rsp), %rdi
callq 0xf698
jmp 0x1c415
cmpl $0x7f, 0x7c(%rsp)
ja 0x1c2da
movb $0x0, 0x28(%rsp)
movl 0x7c(%rsp), %eax
movb %al, 0x27(%rsp)
jmp 0x1c3bf
cmpl $0x7ff, 0x7c(%rsp)      # imm = 0x7FF
ja 0x1c313
movb $0x0, 0x29(%rsp)
leaq 0x7c(%rsp), %rdi
movl $0x6, %esi
callq 0x345e0
orl $0x80, %eax
movb %al, 0x28(%rsp)
movl 0x7c(%rsp), %eax
orl $0xc0, %eax
movb %al, 0x27(%rsp)
jmp 0x1c3bd
cmpl $0xffff, 0x7c(%rsp)     # imm = 0xFFFF
ja 0x1c361
movb $0x0, 0x2a(%rsp)
leaq 0x7c(%rsp), %rdi
movl $0x6, %esi
callq 0x345e0
orl $0x80, %eax
movb %al, 0x29(%rsp)
leaq 0x7c(%rsp), %rdi
movl $0x6, %esi
callq 0x345e0
orl $0x80, %eax
movb %al, 0x28(%rsp)
movl 0x7c(%rsp), %eax
orl $0xe0, %eax
movb %al, 0x27(%rsp)
jmp 0x1c3bb
movb $0x0, 0x2b(%rsp)
leaq 0x7c(%rsp), %rdi
movl $0x6, %esi
callq 0x345e0
orl $0x80, %eax
movb %al, 0x2a(%rsp)
leaq 0x7c(%rsp), %rdi
movl $0x6, %esi
callq 0x345e0
orl $0x80, %eax
movb %al, 0x29(%rsp)
leaq 0x7c(%rsp), %rdi
movl $0x6, %esi
callq 0x345e0
orl $0x80, %eax
movb %al, 0x28(%rsp)
movl 0x7c(%rsp), %eax
orl $0xf0, %eax
movb %al, 0x27(%rsp)
jmp 0x1c3bd
jmp 0x1c3bf
leaq 0x26(%rsp), %rdi
movq %rdi, (%rsp)
callq 0xf420
movq 0x10(%rsp), %rdi
movq (%rsp), %rdx
leaq 0x27(%rsp), %rsi
callq 0x32980
jmp 0x1c3e2
leaq 0x26(%rsp), %rdi
callq 0xeb40
jmp 0x1c408
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
leaq 0x26(%rsp), %rdi
callq 0xeb40
jmp 0x1c415
movq 0x18(%rsp), %rax
addq $0x88, %rsp
retq
movq 0x30(%rsp), %rdi
callq 0xf410
nop