// File: halfflat[P]tinyopt/test/googletest/googletest/src/gtest.cc
// Function: testing::internal::ShouldShard(char const*, char const*, bool)
bool ShouldShard(const char* total_shards_env, const char* shard_index_env,
                 bool in_subprocess_for_death_test) {
  if (in_subprocess_for_death_test) {
    return false;
  }

  const int32_t total_shards = Int32FromEnvOrDie(total_shards_env, -1);
  const int32_t shard_index = Int32FromEnvOrDie(shard_index_env, -1);

  if (total_shards == -1 && shard_index == -1) {
    return false;
  } else if (total_shards == -1 && shard_index != -1) {
    const Message msg = Message() << "Invalid environment variables: you have "
                                  << kTestShardIndex << " = " << shard_index
                                  << ", but have left " << kTestTotalShards
                                  << " unset.\n";
    ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
    fflush(stdout);
    exit(EXIT_FAILURE);
  } else if (total_shards != -1 && shard_index == -1) {
    const Message msg = Message()
                        << "Invalid environment variables: you have "
                        << kTestTotalShards << " = " << total_shards
                        << ", but have left " << kTestShardIndex << " unset.\n";
    ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
    fflush(stdout);
    exit(EXIT_FAILURE);
  } else if (shard_index < 0 || shard_index >= total_shards) {
    const Message msg =
        Message() << "Invalid environment variables: we require 0 <= "
                  << kTestShardIndex << " < " << kTestTotalShards
                  << ", but you have " << kTestShardIndex << "=" << shard_index
                  << ", " << kTestTotalShards << "=" << total_shards << ".\n";
    ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
    fflush(stdout);
    exit(EXIT_FAILURE);
  }

  return total_shards > 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
je 0x8b839
movb $0x0, -0x1(%rbp)
jmp 0x8be26
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x8be40
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x8be40
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x20(%rbp)
jne 0x8b870
cmpl $-0x1, -0x24(%rbp)
jne 0x8b870
movb $0x0, -0x1(%rbp)
jmp 0x8be26
cmpl $-0x1, -0x20(%rbp)
jne 0x8ba0f
cmpl $-0x1, -0x24(%rbp)
je 0x8ba0f
leaq -0x38(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x84210
movq -0xd8(%rbp), %rdi
leaq 0x43b27(%rip), %rsi     # 0xcf3c9
callq 0xab500
movq %rax, -0xd0(%rbp)
jmp 0x8b8b0
movq -0xd0(%rbp), %rdi
leaq 0x40fa2(%rip), %rsi     # 0xcc860
callq 0xa7bf0
movq %rax, -0xe0(%rbp)
jmp 0x8b8cc
movq -0xe0(%rbp), %rdi
leaq 0x43ba3(%rip), %rsi     # 0xcf47d
callq 0xa4240
movq %rax, -0xe8(%rbp)
jmp 0x8b8e8
movq -0xe8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0xa4070
movq %rax, -0xf0(%rbp)
jmp 0x8b901
movq -0xf0(%rbp), %rdi
leaq 0x43ae3(%rip), %rsi     # 0xcf3f2
callq 0xab540
movq %rax, -0xf8(%rbp)
jmp 0x8b91d
movq -0xf8(%rbp), %rdi
leaq 0x40f15(%rip), %rsi     # 0xcc840
callq 0xab580
movq %rax, -0x100(%rbp)
jmp 0x8b939
movq -0x100(%rbp), %rdi
leaq 0x43abc(%rip), %rsi     # 0xcf403
callq 0xab5c0
movq %rax, -0x108(%rbp)
jmp 0x8b955
movq -0x108(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0xab600
jmp 0x8b967
leaq -0x38(%rbp), %rdi
callq 0x1d500
leaq -0x68(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x77710
jmp 0x8b97f
leaq -0x68(%rbp), %rdi
callq 0x102c0
movq %rax, %rdx
leaq 0x43af1(%rip), %rsi     # 0xcf483
xorl %eax, %eax
movl $0x1, %edi
callq 0x8b660
jmp 0x8b9a0
leaq -0x68(%rbp), %rdi
callq 0x10fc8
movq 0x8b5d0(%rip), %rax     # 0x116f80
movq (%rax), %rdi
callq 0x10930
jmp 0x8b9ba
movl $0x1, %edi
callq 0x10990
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x1d500
jmp 0x8be34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8ba01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x10fc8
leaq -0x30(%rbp), %rdi
callq 0x1d500
jmp 0x8be34
cmpl $-0x1, -0x20(%rbp)
je 0x8bbba
cmpl $-0x1, -0x24(%rbp)
jne 0x8bbba
leaq -0x78(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x84210
movq -0x118(%rbp), %rdi
leaq 0x43988(%rip), %rsi     # 0xcf3c9
callq 0xab500
movq %rax, -0x110(%rbp)
jmp 0x8ba4f
movq -0x110(%rbp), %rdi
leaq 0x40de3(%rip), %rsi     # 0xcc840
callq 0xab580
movq %rax, -0x120(%rbp)
jmp 0x8ba6b
movq -0x120(%rbp), %rdi
leaq 0x43a04(%rip), %rsi     # 0xcf47d
callq 0xa4240
movq %rax, -0x128(%rbp)
jmp 0x8ba87
movq -0x128(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xa4070
movq %rax, -0x130(%rbp)
jmp 0x8baa0
movq -0x130(%rbp), %rdi
leaq 0x43944(%rip), %rsi     # 0xcf3f2
callq 0xab540
movq %rax, -0x138(%rbp)
jmp 0x8babc
movq -0x138(%rbp), %rdi
leaq 0x40d96(%rip), %rsi     # 0xcc860
callq 0xa7bf0
movq %rax, -0x140(%rbp)
jmp 0x8bad8
movq -0x140(%rbp), %rdi
leaq 0x4391d(%rip), %rsi     # 0xcf403
callq 0xab5c0
movq %rax, -0x148(%rbp)
jmp 0x8baf4
movq -0x148(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0xab600
jmp 0x8bb06
leaq -0x78(%rbp), %rdi
callq 0x1d500
leaq -0x98(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x77710
jmp 0x8bb21
leaq -0x98(%rbp), %rdi
callq 0x102c0
movq %rax, %rdx
leaq 0x4394c(%rip), %rsi     # 0xcf483
xorl %eax, %eax
movl $0x1, %edi
callq 0x8b660
jmp 0x8bb45
leaq -0x98(%rbp), %rdi
callq 0x10fc8
movq 0x8b428(%rip), %rax     # 0x116f80
movq (%rax), %rdi
callq 0x10930
jmp 0x8bb62
movl $0x1, %edi
callq 0x10990
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x1d500
jmp 0x8be34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8bbac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x10fc8
leaq -0x70(%rbp), %rdi
callq 0x1d500
jmp 0x8be34
cmpl $0x0, -0x24(%rbp)
jl 0x8bbcc
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x8be14
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x84210
movq -0x158(%rbp), %rdi
leaq 0x4381f(%rip), %rsi     # 0xcf40c
callq 0xab6e0
movq %rax, -0x150(%rbp)
jmp 0x8bbfb
movq -0x150(%rbp), %rdi
leaq 0x40c57(%rip), %rsi     # 0xcc860
callq 0xa7bf0
movq %rax, -0x160(%rbp)
jmp 0x8bc17
movq -0x160(%rbp), %rdi
leaq 0x43817(%rip), %rsi     # 0xcf43c
callq 0xa4240
movq %rax, -0x168(%rbp)
jmp 0x8bc33
movq -0x168(%rbp), %rdi
leaq 0x40bff(%rip), %rsi     # 0xcc840
callq 0xab580
movq %rax, -0x170(%rbp)
jmp 0x8bc4f
movq -0x170(%rbp), %rdi
leaq 0x437e3(%rip), %rsi     # 0xcf440
callq 0xa5e50
movq %rax, -0x178(%rbp)
jmp 0x8bc6b
movq -0x178(%rbp), %rdi
leaq 0x40be7(%rip), %rsi     # 0xcc860
callq 0xa7bf0
movq %rax, -0x180(%rbp)
jmp 0x8bc87
movq -0x180(%rbp), %rdi
leaq 0x44263(%rip), %rsi     # 0xcfef8
callq 0xa2e50
movq %rax, -0x188(%rbp)
jmp 0x8bca3
movq -0x188(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0xa4070
movq %rax, -0x190(%rbp)
jmp 0x8bcbc
movq -0x190(%rbp), %rdi
leaq 0x44519(%rip), %rsi     # 0xd01e3
callq 0xa4d00
movq %rax, -0x198(%rbp)
jmp 0x8bcd8
movq -0x198(%rbp), %rdi
leaq 0x40b5a(%rip), %rsi     # 0xcc840
callq 0xab580
movq %rax, -0x1a0(%rbp)
jmp 0x8bcf4
movq -0x1a0(%rbp), %rdi
leaq 0x441f6(%rip), %rsi     # 0xcfef8
callq 0xa2e50
movq %rax, -0x1a8(%rbp)
jmp 0x8bd10
movq -0x1a8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xa4070
movq %rax, -0x1b0(%rbp)
jmp 0x8bd29
movq -0x1b0(%rbp), %rdi
leaq 0x42eac(%rip), %rsi     # 0xcebe3
callq 0xa4d00
movq %rax, -0x1b8(%rbp)
jmp 0x8bd45
movq -0x1b8(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xab600
jmp 0x8bd5a
leaq -0xa8(%rbp), %rdi
callq 0x1d500
leaq -0xc8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x77710
jmp 0x8bd7b
leaq -0xc8(%rbp), %rdi
callq 0x102c0
movq %rax, %rdx
leaq 0x436f2(%rip), %rsi     # 0xcf483
xorl %eax, %eax
movl $0x1, %edi
callq 0x8b660
jmp 0x8bd9f
leaq -0xc8(%rbp), %rdi
callq 0x10fc8
movq 0x8b1ce(%rip), %rax     # 0x116f80
movq (%rax), %rdi
callq 0x10930
jmp 0x8bdbc
movl $0x1, %edi
callq 0x10990
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x1d500
jmp 0x8be34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8be06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x10fc8
leaq -0xa0(%rbp), %rdi
callq 0x1d500
jmp 0x8be34
jmp 0x8be16
jmp 0x8be18
jmp 0x8be1a
cmpl $0x1, -0x20(%rbp)
setg %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x10e00
nopl (%rax)