user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <test_init@plt>
  lea    D60(%rip),%rdi
  call   <getenv@plt>
  lea    D79(%rip),%rdi
  test   %rax,%rax
  mov    %rax,%rbx
  setne  %r13b
  call   <getenv@plt>
  lea    D87(%rip),%rdi
  mov    %rax,%r12
  call   <getenv@plt>
  test   %rax,%rax
  je     L228
  mov    %rax,%rdi
  lea    D19(%rip),%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L228
  mov    $0x2000000,%edi
  mov    $0x1,%r15d
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L164
L198:
  xor    %esi,%esi
  mov    %rbp,%rdi
  mov    $0x2000000,%edx
  call   <memset@plt>
  lea    0x1ffffff(%rbp),%r14
  mov    %r14,%rdi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L62
  test   %r13b,%r13b
  je     L62
  test   %r12,%r12
  je     L5
  test   %r15d,%r15d
  je     L5
  lea    D90(%rip),%r15
L166:
  xor    %eax,%eax
  call   <cleanup@plt>
  mov    %r15,%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  mov    %rbp,%rdi
  call   <free@plt>
L93:
  mov    %r14,%rdi
  call   <test_addr_huge@plt>
  sub    $0x1,%eax
  jne    L59
  xor    %eax,%eax
  call   <cleanup@plt>
  lea    D31(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L59
L228:
  mov    $0x2000000,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L177
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    $0x2000000,%edx
  call   <memset@plt>
  lea    0x1ffffff(%rbp),%r14
  mov    %r14,%rdi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L62
  test   %r13b,%r13b
  je     L62
L5:
  xor    %eax,%eax
  call   <cleanup@plt>
  lea    D65(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%edi
  call   <exit@plt>
L95:
  mov    %rbp,%rdi
  call   <free@plt>
  test   %r12,%r12
  jne    L93
L59:
  xor    %eax,%eax
  call   <cleanup@plt>
  lea    D92(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L62:
  sub    $0x1,%eax
  sete   %al
  test   %rbx,%rbx
  jne    L95
  test   %al,%al
  je     L95
L176:
  xor    %eax,%eax
  call   <cleanup@plt>
  lea    D34(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L95
L177:
  xor    %r15d,%r15d
L229:
  xor    %eax,%eax
  xor    %ebp,%ebp
  call   <cleanup@plt>
  mov    $0x2000000,%esi
  lea    D81(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L198
L164:
  test   %r12,%r12
  je     L229
  xor    %eax,%eax
  lea    D90(%rip),%r15
  call   <cleanup@plt>
  mov    %r15,%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  xor    %edi,%edi
  xor    %esi,%esi
  mov    $0x2000000,%edx
  call   <memset@plt>
  mov    $0x1ffffff,%edi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L203
  mov    $0x1ffffff,%r14d
  test   %r13b,%r13b
  jne    L166
L203:
  test   %rbx,%rbx
  jne    L73
  sub    $0x1,%eax
  mov    $0x1ffffff,%r14d
  je     L176
L73:
  xor    %edi,%edi
  mov    $0x1ffffff,%r14d
  call   <free@plt>
  jmp    L93
```

tool_calls: name: parse_data
arguments: tag: D60
type_infered: string
name: parse_data
arguments: tag: D79
type_infered: string
name: parse_data
arguments: tag: D87
type_infered: string
name: parse_data
arguments: tag: D19
type_infered: string
name: parse_data
arguments: tag: D90
type_infered: string
name: parse_data
arguments: tag: D31
type_infered: string
name: parse_data
arguments: tag: D65
type_infered: string
name: parse_data
arguments: tag: D92
type_infered: string
name: parse_data
arguments: tag: D34
type_infered: string
name: parse_data
arguments: tag: D81
type_infered: string

tool: D60: HUGETLB_MORECORE

tool: D79: HUGETLB_MORECORE_SHRINK

tool: D87: LD_PRELOAD

tool: D19: heapshrink

tool: D90: PASS (inconclusive)

tool: D31: FAIL	Heap did not shrink

tool: D65: FAIL	Heap not on hugepages

tool: D92: PASS

tool: D34: FAIL	Heap unexpectedly on hugepages

tool: D81: FAIL	malloc(%d) failed



assistant: ```c
int main(int argc, char **argv) {
  int is_huge, have_env, shrink_ok, have_helper;
  void *p;
  test_init(argc, argv);
  have_env = getenv("HUGETLB_MORECORE") != NULL;
  shrink_ok = getenv("HUGETLB_MORECORE_SHRINK") != NULL;
  p = getenv("LD_PRELOAD");
  have_helper = p != NULL && strstr(p, "heapshrink") != NULL;
  p = malloc((32 * 1024 * 1024));
  if (!p) {
    if (shrink_ok && have_helper) {
      do {
        cleanup();
        printf("PASS (inconclusive)\n");
        exit(0);
      } while (0);
    } else
      do {
        cleanup();
        printf("FAIL\t"
               "malloc(%d) failed\n"
               "\n",
               (32 * 1024 * 1024));
        exit(2);
      } while (0);
  }
  memset(p, 0, (32 * 1024 * 1024));
  is_huge = test_addr_huge(p + (32 * 1024 * 1024) - 1) == 1;
  if (have_env && !is_huge) {
    if (shrink_ok && have_helper) {
      do {
        cleanup();
        printf("PASS (inconclusive)\n");
        exit(0);
      } while (0);
    } else
      do {
        cleanup();
        printf("FAIL\t"
               "Heap not on hugepages"
               "\n");
        exit(2);
      } while (0);
  }
  if (!have_env && is_huge)
    do {
      cleanup();
      printf("FAIL\t"
             "Heap unexpectedly on hugepages"
             "\n");
      exit(2);
    } while (0);
  free(p);
  if (shrink_ok && test_addr_huge(p + (32 * 1024 * 1024) - 1) == 1)
    do {
      cleanup();
      printf("FAIL\t"
             "Heap did not shrink"
             "\n");
      exit(2);
    } while (0);
  do {
    cleanup();
    printf("PASS\n");
    exit(0);
  } while (0);
}
```