user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<chopGribFile>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1008(%rsp)
  xor    %eax,%eax
  mov    %rdi,%r15
  mov    %rsi,%r14
  mov    %rdx,%r12
  mov    %rcx,%r13
  cmp    $0x2,%r8d
  ja     L27
  mov    %rsp,%rbp
  mov    %rdx,%rcx
  lea    D16(%rip),%rsi
  mov    %rdi,%rdx
  xor    %eax,%eax
  mov    %rbp,%rdi
  mov    %r8d,%ebx
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <callSystem@plt>
  mov    %r13,%r8
  mov    %r12,%rcx
  mov    %r12,%rdx
  test   %ebx,%ebx
  je     L63
  cmp    $0x1,%ebx
  je     L25
  lea    D37(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  nopw   0x0(%rax,%rax,1)
L64:
  mov    %rbp,%rdi
  call   <callSystem@plt>
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rdi
  lea    D15(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <callSystem@plt>
  mov    %r12,%rdi
  call   <removeAFile@plt>
  mov    %r13,%rdi
  call   <removeAFile@plt>
  mov    0x1008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L35
  add    $0x1018,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L63:
  lea    D44(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L64
  nopl   0x0(%rax,%rax,1)
L27:
  lea    D57(%rip),%rdi
  mov    %rsp,%rbp
  call   <printf@plt>
  xor    %edi,%edi
  call   <exit@plt>
  mov    %rbp,%rdi
  mov    %r12,%rcx
  mov    %r15,%rdx
  lea    D16(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <callSystem@plt>
  jmp    L64
  nopw   0x0(%rax,%rax,1)
L25:
  lea    D59(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L64
L35:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D16
type_infered: string
name: parse_data
arguments: data_tag: D37
type_infered: string
name: parse_data
arguments: data_tag: D15
type_infered: string
name: parse_data
arguments: data_tag: D44
type_infered: string
name: parse_data
arguments: data_tag: D57
type_infered: string
name: parse_data
arguments: data_tag: D59
type_infered: string

tool: D16: ./wgrib2 %s -if_n 6::6 -s -set_grib_type c3 -grib_out %s

tool: D37: ./wgrib2 %s | grep ":d=$YYYYMMDD" | ./wgrib2 -i %s -if '00:PRATE:' -rpn sto_1 -fi -if '06:PRATE:' -rpn sto_2 -fi -if '12:PRATE:' -rpn sto_3 -fi -if '18:PRATE:' -rpn sto_4 -fi -if_reg '1:2:3:4' -rpn 'rcl_1:rcl_2:rcl_3:rcl_4:+:+:+' -set_ave '4@6 hour max(0-6 hour max fcst),missing=0' -set_grib_type c3 -grib_out %s

tool: D15: ./wgrib2 %s -if_n 1::4 -s -set_grib_type c3 -grib_out %s

tool: D44: ./wgrib2 %s | grep ":d=$YYYYMMDD" | ./wgrib2 -i %s -if '00:TMAX:' -rpn sto_1 -fi -if '06:TMAX:' -rpn sto_2 -fi -if '12:TMAX:' -rpn sto_3 -fi -if '18:TMAX:' -rpn sto_4 -fi -if_reg '1:2:3:4' -rpn 'rcl_1:rcl_2:rcl_3:rcl_4:max:max:max' -set_ave '4@6 hour max(0-6 hour max fcst),missing=0' -set_grib_type c3 -grib_out %s

tool: D57: Invalid chop type specified, exiting


tool: D59: ./wgrib2 %s | grep ":d=$YYYYMMDD" | ./wgrib2 -i %s -if '00:TMIN:' -rpn sto_1 -fi -if '06:TMIN:' -rpn sto_2 -fi -if '12:TMIN:' -rpn sto_3 -fi -if '18:TMIN:' -rpn sto_4 -fi -if_reg '1:2:3:4' -rpn 'rcl_1:rcl_2:rcl_3:rcl_4:min:min:min' -set_ave '4@6 hour max(0-6 hour max fcst),missing=0' -set_grib_type c3 -grib_out %s

assistant: ```c
void chopGribFile(char *inFileName, char *outFileName, char *tempFileName, char *tempFileName2, int type) {
  if (type < 0 || type > 2) {
    printf("Invalid chop type specified, exiting\n");
    exit(0);
  }
  char systemCall[4096];
  sprintf(systemCall, "./wgrib2 %s -if_n 6::6 -s -set_grib_type c3 -grib_out %s", inFileName, tempFileName);
  callSystem(systemCall);
  if (type == 0)
    sprintf(systemCall, "./wgrib2 %s | grep \":d=$YYYYMMDD\" | ./wgrib2 -i %s -if '00:TMAX:' -rpn sto_1 -fi -if '06:TMAX:' -rpn sto_2 -fi -if '12:TMAX:' -rpn sto_3 -fi -if '18:TMAX:' -rpn sto_4 -fi -if_reg '1:2:3:4' -rpn 'rcl_1:rcl_2:rcl_3:rcl_4:max:max:max' -set_ave '4@6 hour max(0-6 hour max fcst),missing=0' -set_grib_type c3 -grib_out %s", tempFileName, tempFileName, tempFileName2);
  else if (type == 1)
    sprintf(systemCall, "./wgrib2 %s | grep \":d=$YYYYMMDD\" | ./wgrib2 -i %s -if '00:TMIN:' -rpn sto_1 -fi -if '06:TMIN:' -rpn sto_2 -fi -if '12:TMIN:' -rpn sto_3 -fi -if '18:TMIN:' -rpn sto_4 -fi -if_reg '1:2:3:4' -rpn 'rcl_1:rcl_2:rcl_3:rcl_4:min:min:min' -set_ave '4@6 hour max(0-6 hour max fcst),missing=0' -set_grib_type c3 -grib_out %s", tempFileName, tempFileName, tempFileName2);
  else if (type == 2)
    sprintf(systemCall, "./wgrib2 %s | grep \":d=$YYYYMMDD\" | ./wgrib2 -i %s -if '00:PRATE:' -rpn sto_1 -fi -if '06:PRATE:' -rpn sto_2 -fi -if '12:PRATE:' -rpn sto_3 -fi -if '18:PRATE:' -rpn sto_4 -fi -if_reg '1:2:3:4' -rpn 'rcl_1:rcl_2:rcl_3:rcl_4:+:+:+' -set_ave '4@6 hour max(0-6 hour max fcst),missing=0' -set_grib_type c3 -grib_out %s", tempFileName, tempFileName, tempFileName2);
  callSystem(systemCall);
  sprintf(systemCall, "./wgrib2 %s -if_n 1::4 -s -set_grib_type c3 -grib_out %s", tempFileName2, outFileName);
  callSystem(systemCall);
  removeAFile(tempFileName);
  removeAFile(tempFileName2);
}
```