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    $0x18,%rsp
  call   <test_init@plt>
  lea    D22(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%r12
  test   %rax,%rax
  setne  %r14b
  lea    D14(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  setne  %r15b
  lea    D96(%rip),%rdi
  call   <getenv@plt>
  test   %rax,%rax
  je     L237
  lea    D109(%rip),%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  setne  0xf(%rsp)
  mov    $0x2000000,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L14
  mov    $0x2000000,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    0x1ffffff(%rbx),%r13
  mov    %r13,%rdi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L102
  test   %r14b,%r14b
  je     L102
  test   %r15b,%r15b
  je     L197
  cmpb   $0x0,0xf(%rsp)
  je     L197
L234:
  mov    $0x0,%eax
  call   <cleanup@plt>
  lea    D9(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L205
L14:
  test   %r15b,%r15b
  je     L210
  cmpb   $0x0,0xf(%rsp)
  je     L210
  mov    $0x0,%eax
  call   <cleanup@plt>
  lea    D9(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x2000000,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <memset@plt>
  mov    $0x1ffffff,%edi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L219
  mov    $0x1ffffff,%r13d
  test   %r14b,%r14b
  jne    L234
L219:
  cmp    $0x1,%eax
  jne    L31
  mov    $0x1ffffff,%r13d
  test   %r12,%r12
  je     L32
L31:
  mov    $0x0,%edi
  call   <free@plt>
  mov    $0x1ffffff,%r13d
  jmp    L249
L210:
  mov    $0x0,%eax
  call   <cleanup@plt>
  mov    $0x2000000,%esi
  lea    D19(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  mov    $0x2000000,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <memset@plt>
  mov    $0x1ffffff,%edi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L206
  test   %r14b,%r14b
  je     L206
  mov    $0x0,%ebx
  mov    $0x1ffffff,%r13d
  jmp    L197
L206:
  cmp    $0x1,%eax
  sete   %al
  mov    $0x0,%ebx
  mov    $0x1ffffff,%r13d
  jmp    L229
L102:
  cmp    $0x1,%eax
  sete   %al
L229:
  test   %r12,%r12
  jne    L205
  test   %al,%al
  je     L205
L32:
  mov    $0x0,%eax
  call   <cleanup@plt>
  lea    D93(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%edi
  call   <exit@plt>
L205:
  mov    %rbx,%rdi
  call   <free@plt>
  test   %rbp,%rbp
  je     L50
L249:
  mov    %r13,%rdi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L111
L50:
  mov    $0x0,%eax
  call   <cleanup@plt>
  lea    D46(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L111:
  mov    $0x0,%eax
  call   <cleanup@plt>
  lea    D52(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L50
L237:
  mov    $0x2000000,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L210
  mov    $0x2000000,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    0x1ffffff(%rbx),%r13
  mov    %r13,%rdi
  call   <test_addr_huge@plt>
  cmp    $0x1,%eax
  je     L102
  test   %r14b,%r14b
  je     L102
L197:
  mov    $0x0,%eax
  call   <cleanup@plt>
  lea    D3(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L205
```

tool_calls: name: extract_symbolic_data
arguments: tag: D22
datatype: string
name: extract_symbolic_data
arguments: tag: D14
datatype: string
name: extract_symbolic_data
arguments: tag: D96
datatype: string
name: extract_symbolic_data
arguments: tag: D109
datatype: string
name: extract_symbolic_data
arguments: tag: D9
datatype: string
name: extract_symbolic_data
arguments: tag: D19
datatype: string
name: extract_symbolic_data
arguments: tag: D93
datatype: string
name: extract_symbolic_data
arguments: tag: D46
datatype: string
name: extract_symbolic_data
arguments: tag: D52
datatype: string
name: extract_symbolic_data
arguments: tag: D3
datatype: string

tool: D22: HUGETLB_MORECORE

tool: D14: HUGETLB_MORECORE_SHRINK

tool: D96: LD_PRELOAD

tool: D109: heapshrink

tool: D9: PASS (inconclusive)

tool: D19: FAIL	malloc(%d) failed



tool: D93: FAIL	Heap unexpectedly on hugepages

tool: D46: PASS

tool: D52: FAIL	Heap did not shrink

tool: D3: FAIL	Heap not on hugepages

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);
}
```