int test_uint64_encode() {
  _help_test_uint64_encode(0);
  _help_test_uint64_encode(1);
  _help_test_uint64_encode(2);
  _help_test_uint64_encode(24);
  _help_test_uint64_encode(42);
  _help_test_uint64_encode(53);
  _help_test_uint64_encode(99);
  _help_test_uint64_encode((1 << 8) - 2);
  _help_test_uint64_encode((1 << 8) - 1);
  _help_test_uint64_encode((1 << 8));
  _help_test_uint64_encode((1 << 8) + 1);
  _help_test_uint64_encode((1 << 8) + 2);
  _help_test_uint64_encode((1 << 16) - 2);
  _help_test_uint64_encode((1 << 16) - 1);
  _help_test_uint64_encode((1 << 16));
  _help_test_uint64_encode((1 << 16) + 1);
  _help_test_uint64_encode((1 << 16) + 2);
  _help_test_uint64_encode((1 << 24) - 2);
  _help_test_uint64_encode((1 << 24) - 1);
  _help_test_uint64_encode((1 << 24));
  _help_test_uint64_encode((1 << 24) + 1);
  _help_test_uint64_encode((1 << 24) + 2);
  _help_test_uint64_encode(
      ((unsigned long)((1ULL << ((32) - 1)) | ((1ULL << ((32) - 1)) - 1))) - 2);
  _help_test_uint64_encode(
      ((unsigned long)((1ULL << ((32) - 1)) | ((1ULL << ((32) - 1)) - 1))) - 1);
  _help_test_uint64_encode(
      ((unsigned long)((1ULL << ((32) - 1)) | ((1ULL << ((32) - 1)) - 1))));
  _help_test_uint64_encode(
      ((unsigned long)((1ULL << ((32) - 1)) | ((1ULL << ((32) - 1)) - 1))) +
      1LLU);
  _help_test_uint64_encode(
      ((unsigned long)((1ULL << ((32) - 1)) | ((1ULL << ((32) - 1)) - 1))) +
      2LLU);
  _help_test_uint64_encode(((unsigned long long)((1ULL << ((64) - 1)) |
                                                 ((1ULL << ((64) - 1)) - 1))) -
                           2);
  _help_test_uint64_encode(((unsigned long long)((1ULL << ((64) - 1)) |
                                                 ((1ULL << ((64) - 1)) - 1))) -
                           1);
  _help_test_uint64_encode((
      (unsigned long long)((1ULL << ((64) - 1)) | ((1ULL << ((64) - 1)) - 1))));
  return 1;
}


x86 assembly (clang, -O0):
<test_uint64_encode>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x18,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x2a,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x35,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x63,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfe,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xff,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x100,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x101,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x102,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffe,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xffff,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x10000,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x10001,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x10002,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffe,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xffffff,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1000000,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1000001,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1000002,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffffd,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffffe,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xffffffff,%edi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
movabs $0x100000000,%rdi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
movabs $0x100000001,%rdi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffffffffffffd,%rdi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffffffffffffe,%rdi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0xffffffffffffffff,%rdi
mov    $0x0,%al
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_uint64_encode>:
push   %rbx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x2,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x18,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x2a,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x35,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x63,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfe,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xff,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x100,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x101,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x102,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffe,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xffff,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x10000,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x10001,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x10002,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffe,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xffffff,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1000000,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1000001,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1000002,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffffd,%ebx
mov    $0xfffffffd,%edi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
lea    0x1(%rbx),%rdi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
lea    0x2(%rbx),%rdi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
lea    0x3(%rbx),%rdi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
add    $0x4,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffffffffffffd,%rdi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xfffffffffffffffe,%rdi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0xffffffffffffffff,%rdi
xor    %eax,%eax
call   1030 <_help_test_uint64_encode@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_uint64_encode() {
%1 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 0)
%2 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 1)
%3 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 2)
%4 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 24)
%5 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 42)
%6 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 53)
%7 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 99)
%8 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 254)
%9 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 255)
%10 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 256)
%11 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 257)
%12 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 258)
%13 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65534)
%14 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65535)
%15 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65536)
%16 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65537)
%17 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65538)
%18 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777214)
%19 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777215)
%20 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777216)
%21 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777217)
%22 = call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777218)
%23 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967293)
%24 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967294)
%25 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967295)
%26 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967296)
%27 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967297)
%28 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 -3)
%29 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 -2)
%30 = call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 -1)
ret i32 1
}

LLVM IR (-O2):
define i32 @test_uint64_encode() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 0)
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 1)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 2)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 24)
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 42)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 53)
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 99)
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 254)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 255)
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 256)
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 257)
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 258)
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65534)
%14 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65535)
%15 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65536)
%16 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65537)
%17 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 65538)
%18 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777214)
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777215)
%20 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777216)
%21 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777217)
%22 = tail call i32 (i32, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i32, ...)*)(i32 16777218)
%23 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967293)
%24 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967294)
%25 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967295)
%26 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967296)
%27 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 4294967297)
%28 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 -3)
%29 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 -2)
%30 = tail call i32 (i64, ...) bitcast (i32 (...)* @_help_test_uint64_encode to i32 (i64, ...)*)(i64 -1)
ret i32 1
}