user: 请从给定的汇编指令推导出C源代码：

```asm
<chopGribFile>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x40,%rsp
  mov    %rdi,-0x1018(%rbp)
  mov    %rsi,-0x1020(%rbp)
  mov    %rdx,-0x1028(%rbp)
  mov    %rcx,-0x1030(%rbp)
  mov    %r8d,-0x1034(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0x1034(%rbp)
  js     L27
  cmpl   $0x2,-0x1034(%rbp)
  jle    L21
L27:
  lea    D43(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L21:
  mov    -0x1028(%rbp),%rcx
  mov    -0x1018(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  lea    D8(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x1010(%rbp),%rax
  mov    %rax,%rdi
  call   <callSystem@plt>
  cmpl   $0x0,-0x1034(%rbp)
  jne    L4
  mov    -0x1030(%rbp),%rsi
  mov    -0x1028(%rbp),%rcx
  mov    -0x1028(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  mov    %rsi,%r8
  lea    D56(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L16
L4:
  cmpl   $0x1,-0x1034(%rbp)
  jne    L2
  mov    -0x1030(%rbp),%rsi
  mov    -0x1028(%rbp),%rcx
  mov    -0x1028(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  mov    %rsi,%r8
  lea    D36(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L16
L2:
  cmpl   $0x2,-0x1034(%rbp)
  jne    L16
  mov    -0x1030(%rbp),%rsi
  mov    -0x1028(%rbp),%rcx
  mov    -0x1028(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  mov    %rsi,%r8
  lea    D14(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L16:
  lea    -0x1010(%rbp),%rax
  mov    %rax,%rdi
  call   <callSystem@plt>
  mov    -0x1020(%rbp),%rcx
  mov    -0x1030(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  lea    D4(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x1010(%rbp),%rax
  mov    %rax,%rdi
  call   <callSystem@plt>
  mov    -0x1028(%rbp),%rax
  mov    %rax,%rdi
  call   <removeAFile@plt>
  mov    -0x1030(%rbp),%rax
  mov    %rax,%rdi
  call   <removeAFile@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L49
  call   <__stack_chk_fail@plt>
L49:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D43
datatype: string
name: retrieve_data
arguments: tag: D8
datatype: string
name: retrieve_data
arguments: tag: D56
datatype: string
name: retrieve_data
arguments: tag: D36
datatype: string
name: retrieve_data
arguments: tag: D14
datatype: string
name: retrieve_data
arguments: tag: D4
datatype: string

tool: D43: Invalid chop type specified, exiting


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

tool: D56: ./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: D36: ./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

tool: D14: ./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: D4: ./wgrib2 %s -if_n 1::4 -s -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);
}
```