user: 请将以下的汇编代码转换成C语言代码：

```asm
<CmdNewEnvironment>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,0xc(%rsp)
  mov    $0x0,%eax
  call   <getBraceParam@plt>
  mov    %rax,%r14
  mov    $0x0,%eax
  call   <getBracketParam@plt>
  mov    %rax,%rbx
  mov    $0x0,%eax
  call   <getBracketParam@plt>
  mov    %rax,%rbp
  mov    $0x0,%eax
  call   <getBraceParam@plt>
  mov    %rax,%r13
  mov    $0x0,%eax
  call   <getBraceParam@plt>
  mov    %rax,%r12
  mov    %r14,%rdi
  call   <UpdateLineNumber@plt>
  mov    %rbx,%rdi
  call   <UpdateLineNumber@plt>
  test   %rbp,%rbp
  je     L12
  mov    %rbp,%rdi
  call   <UpdateLineNumber@plt>
L12:
  mov    %r13,%rdi
  call   <UpdateLineNumber@plt>
  mov    %r12,%rdi
  call   <UpdateLineNumber@plt>
  mov    $0x0,%r15d
  test   %rbx,%rbx
  je     L64
  movzbl (%rbx),%r15d
  lea    -0x30(%r15),%eax
  cmp    $0x9,%al
  ja     L7
  movsbl %r15b,%r15d
  sub    $0x30,%r15d
L64:
  mov    %r15d,%ecx
  mov    %r14,%rdx
  lea    D23(%rip),%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <diagnostics@plt>
  mov    %r13,%rdx
  lea    D31(%rip),%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <diagnostics@plt>
  mov    %r12,%rdx
  lea    D11(%rip),%rsi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <diagnostics@plt>
  cmpl   $0x1,0xc(%rsp)
  je     L18
  mov    %r15d,%r8d
  mov    %r12,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <renewEnvironment@plt>
L21:
  test   %rbp,%rbp
  je     L56
  mov    %rbp,%rdi
  call   <free@plt>
L56:
  mov    %r14,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  test   %rbx,%rbx
  je     L26
  mov    %rbx,%rdi
  call   <free@plt>
L26:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L7:
  lea    D35(%rip),%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <diagnostics@plt>
  mov    $0x0,%r15d
  jmp    L64
L18:
  mov    %r15d,%r8d
  mov    %r12,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <newEnvironment@plt>
  jmp    L21
```

tool_calls: name: unpack_data
arguments: label: D23
type_infered: string
name: unpack_data
arguments: label: D31
type_infered: string
name: unpack_data
arguments: label: D11
type_infered: string
name: unpack_data
arguments: label: D35
type_infered: string

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

tool: D31: CmdNewEnvironment begdef=<%s>

tool: D11: CmdNewEnvironment enddef=<%s>

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