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

```asm
<CmdNewEnvironment>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  call   <getBraceParam@plt>
  mov    %rax,%r15
  xor    %eax,%eax
  call   <getBracketParam@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  call   <getBracketParam@plt>
  mov    %rax,%r12
  xor    %eax,%eax
  call   <getBraceParam@plt>
  mov    %rax,%r14
  xor    %eax,%eax
  call   <getBraceParam@plt>
  mov    %r15,%rdi
  mov    %rax,%r13
  call   <UpdateLineNumber@plt>
  mov    %rbp,%rdi
  call   <UpdateLineNumber@plt>
  test   %r12,%r12
  je     L7
  mov    %r12,%rdi
  call   <UpdateLineNumber@plt>
L7:
  mov    %r14,%rdi
  call   <UpdateLineNumber@plt>
  mov    %r13,%rdi
  call   <UpdateLineNumber@plt>
  xor    %r8d,%r8d
  test   %rbp,%rbp
  je     L75
  movzbl 0x0(%rbp),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L27
  movsbl %al,%r8d
L75:
  mov    %r8d,%ecx
  mov    %r15,%rdx
  lea    D38(%rip),%rsi
  xor    %eax,%eax
  mov    $0x2,%edi
  mov    %r8d,0xc(%rsp)
  call   <diagnostics@plt>
  mov    %r14,%rdx
  mov    $0x2,%edi
  xor    %eax,%eax
  lea    D17(%rip),%rsi
  call   <diagnostics@plt>
  mov    %r13,%rdx
  mov    $0x2,%edi
  xor    %eax,%eax
  lea    D28(%rip),%rsi
  call   <diagnostics@plt>
  cmp    $0x1,%ebx
  mov    0xc(%rsp),%r8d
  mov    %r13,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %r15,%rdi
  je     L14
  call   <renewEnvironment@plt>
L5:
  test   %r12,%r12
  je     L59
  mov    %r12,%rdi
  call   <free@plt>
L59:
  mov    %r15,%rdi
  call   <free@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  test   %rbp,%rbp
  je     L30
  add    $0x18,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <free@plt>
  nopw   0x0(%rax,%rax,1)
L27:
  lea    D29(%rip),%rsi
  xor    %edi,%edi
  xor    %eax,%eax
  mov    %r8d,0xc(%rsp)
  call   <diagnostics@plt>
  mov    0xc(%rsp),%r8d
  jmp    L75
  nop
L30:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L14:
  call   <newEnvironment@plt>
  jmp    L5
```

tool_calls: name: read_data
arguments: label: D38
datatype: string
name: read_data
arguments: label: D17
datatype: string
name: read_data
arguments: label: D28
datatype: string
name: read_data
arguments: label: D29
datatype: string

tool: D38: CmdNewEnvironment name=<%s> param=%d

tool: D17: CmdNewEnvironment begdef=<%s>

tool: D28: CmdNewEnvironment enddef=<%s>

tool: D29: non-numeric number of parameters in newcommand

assistant: ```c
void CmdNewEnvironment(int code) {
  char *name, *opt_param, *begdef, *enddef, *params;
  int param;
  name = getBraceParam();
  params = getBracketParam();
  opt_param = getBracketParam();
  begdef = getBraceParam();
  enddef = getBraceParam();
  UpdateLineNumber(name);
  UpdateLineNumber(params);
  if (opt_param)
    UpdateLineNumber(opt_param);
  UpdateLineNumber(begdef);
  UpdateLineNumber(enddef);
  param = 0;
  if (params) {
    if ('0' <= *params && *params <= '9')
      param = *params - '0';
    else
      diagnostics(0, "non-numeric number of parameters in newcommand");
  }
  diagnostics(2, "CmdNewEnvironment name=<%s> param=%d", name, param);
  diagnostics(2, "CmdNewEnvironment begdef=<%s>", begdef);
  diagnostics(2, "CmdNewEnvironment enddef=<%s>", enddef);
  if (code == 1)
    newEnvironment(name, opt_param, begdef, enddef, param);
  else
    renewEnvironment(name, opt_param, begdef, enddef, param);
  if (opt_param)
    free(opt_param);
  free(name);
  free(begdef);
  free(enddef);
  if (params)
    free(params);
}
```