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     L44
  mov    %rsp,%rbp
  mov    %rdx,%rcx
  lea    D1(%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     L12
  cmp    $0x1,%ebx
  je     L47
  lea    D50(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  nopw   0x0(%rax,%rax,1)
L30:
  mov    %rbp,%rdi
  call   <callSystem@plt>
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rdi
  lea    D60(%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    L10
  add    $0x1018,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L12:
  lea    D41(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L30
  nopl   0x0(%rax,%rax,1)
L44:
  lea    D12(%rip),%rdi
  mov    %rsp,%rbp
  call   <printf@plt>
  xor    %edi,%edi
  call   <exit@plt>
  mov    %rbp,%rdi
  mov    %r12,%rcx
  mov    %r15,%rdx
  lea    D1(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <callSystem@plt>
  jmp    L30
  nopw   0x0(%rax,%rax,1)
L47:
  lea    D52(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L30
L10:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D1
type: string
name: read_data
arguments: tag: D50
type: string
name: read_data
arguments: tag: D60
type: string
name: read_data
arguments: tag: D41
type: string
name: read_data
arguments: tag: D12
type: string
name: read_data
arguments: tag: D52
type: string

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

tool: D50: ./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: D60: ./wgrib2 %s -if_n 1::4 -s -set_grib_type c3 -grib_out %s

tool: D41: ./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: D12: Invalid chop type specified, exiting


tool: D52: ./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);
}
```