user: Translate the below assembly code into C programming language:

```asm
<extract2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x170,%rsp
  mov    %rdi,-0x138(%rbp)
  mov    %rsi,-0x140(%rbp)
  mov    %edx,-0x144(%rbp)
  mov    %ecx,-0x148(%rbp)
  mov    %r8d,-0x14c(%rbp)
  mov    %r9,-0x158(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,-0x160(%rbp)
  mov    0x28(%rbp),%rax
  mov    %rax,-0x168(%rbp)
  mov    0x30(%rbp),%rax
  mov    %rax,-0x170(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x138(%rbp),%rax
  mov    %rax,%rdi
  call   <rewind@plt>
  movl   $0x0,-0x12c(%rbp)
  jmp    L185
L16:
  movl   $0x0,-0x128(%rbp)
  jmp    L162
L203:
  movl   $0x0,-0x11c(%rbp)
  jmp    L104
L118:
  cmpl   $0x1,0x58(%rbp)
  jne    L3
  mov    -0x11c(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,%rdx
  mov    -0x168(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x128(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,%rdx
  mov    -0x160(%rbp),%rax
  add    %rax,%rdx
  mov    -0x12c(%rbp),%eax
  movslq %eax,%rsi
  mov    %rsi,%rax
  shl    $0x2,%rax
  add    %rsi,%rax
  shl    $0x2,%rax
  mov    %rax,%rsi
  mov    -0x170(%rbp),%rax
  add    %rsi,%rax
  mov    %rax,%rsi
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L3:
  mov    -0x11c(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,%rdx
  mov    -0x168(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x128(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,%rdx
  mov    -0x160(%rbp),%rax
  add    %rax,%rdx
  mov    -0x12c(%rbp),%eax
  movslq %eax,%rsi
  mov    %rsi,%rax
  shl    $0x2,%rax
  add    %rsi,%rax
  shl    $0x2,%rax
  mov    %rax,%rsi
  mov    -0x170(%rbp),%rax
  add    %rax,%rsi
  mov    -0x138(%rbp),%rax
  mov    %rax,%rdi
  call   <find_TSVL@plt>
  mov    %rax,-0x138(%rbp)
  cmpq   $0x0,-0x138(%rbp)
  je     L30
  movl   $0x1,-0x118(%rbp)
  jmp    L219
L76:
  mov    -0x138(%rbp),%rdx
  lea    -0x110(%rbp),%rax
  mov    $0xff,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  mov    -0x140(%rbp),%rdx
  lea    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fputs@plt>
  addl   $0x1,-0x118(%rbp)
L219:
  cmpl   $0xe,-0x118(%rbp)
  jle    L76
  movl   $0x0,-0x114(%rbp)
  movl   $0x1,-0x124(%rbp)
  jmp    L47
L123:
  movl   $0x1,-0x120(%rbp)
  jmp    L72
L20:
  lea    -0x130(%rbp),%rdx
  mov    -0x138(%rbp),%rax
  lea    D22(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    -0x124(%rbp),%eax
  cmp    0x50(%rbp),%eax
  jg     L82
  mov    -0x124(%rbp),%eax
  cmp    0x48(%rbp),%eax
  jl     L82
  mov    -0x120(%rbp),%eax
  cmp    0x40(%rbp),%eax
  jl     L82
  mov    -0x120(%rbp),%eax
  cmp    0x38(%rbp),%eax
  jg     L82
  addl   $0x1,-0x114(%rbp)
  cmpl   $0x7,-0x114(%rbp)
  jle    L29
  movss  -0x130(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd %xmm0,%xmm1
  movq   %xmm1,%rdx
  mov    -0x140(%rbp),%rax
  movq   %rdx,%xmm0
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  movl   $0x0,-0x114(%rbp)
  jmp    L82
L29:
  movss  -0x130(%rbp),%xmm0
  pxor   %xmm2,%xmm2
  cvtss2sd %xmm0,%xmm2
  movq   %xmm2,%rdx
  mov    -0x140(%rbp),%rax
  movq   %rdx,%xmm0
  lea    D39(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
L82:
  addl   $0x1,-0x120(%rbp)
L72:
  mov    -0x120(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jle    L20
  addl   $0x1,-0x124(%rbp)
L47:
  mov    -0x124(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jle    L123
  cmpl   $0x0,-0x114(%rbp)
  je     L92
  mov    -0x140(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  movl   $0x0,-0x114(%rbp)
L92:
  addl   $0x1,-0x11c(%rbp)
L104:
  mov    -0x128(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x158(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x11c(%rbp)
  jl     L118
  addl   $0x1,-0x128(%rbp)
L162:
  mov    -0x128(%rbp),%eax
  cmp    -0x144(%rbp),%eax
  jl     L203
  addl   $0x1,-0x12c(%rbp)
L185:
  mov    -0x12c(%rbp),%eax
  cmp    -0x14c(%rbp),%eax
  jl     L16
  mov    $0x0,%eax
  jmp    L69
L30:
  nop
  mov    $0xffffffff,%eax
L69:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D19
type_infered: string
name: retrieve_data
arguments: data_tag: D22
type_infered: string
name: retrieve_data
arguments: data_tag: D6
type_infered: string
name: retrieve_data
arguments: data_tag: D39
type_infered: string

tool: D19: [%s][%s][%s]


tool: D22:  %f

tool: D6: %.6e


tool: D39: %.6e 

assistant: ```c
int extract2(FILE *fpin, FILE *fpout, int NumVars, int NumLev, int NumTimes, int Nl[], int Nr, int Nc, char VarName[][10], char LevName[][10], char TStepName[][20], int east_bound, int west_bound, int north_bound, int south_bound, int flag_i) {
  int it, iv, ir, ic, il, skip, val_cnt;
  float val;
  char inStr[255];
  rewind(fpin);
  for (it = 0; it < NumTimes; it++) {
    for (iv = 0; iv < NumVars; iv++) {
      for (il = 0; il < Nl[iv]; il++) {
        if (flag_i == 1)
          printf("[%s][%s][%s]\n", TStepName[it], VarName[iv], LevName[il]);
        fpin = find_TSVL(fpin, TStepName[it], VarName[iv], LevName[il]);
        if (fpin == NULL)
          goto err;
        for (skip = 1; skip <= 14; skip++) {
          fgets(inStr, 255, fpin);
          fprintf(fpout, "%s", inStr);
        }
        val_cnt = 0;
        for (ir = 1; ir <= Nr; ir++) {
          for (ic = 1; ic <= Nc; ic++) {
            fscanf(fpin, " %f", &val);
            if ((ir <= south_bound) && (ir >= north_bound) && (ic >= west_bound) && (ic <= east_bound)) {
              val_cnt++;
              if (val_cnt >= 8) {
                fprintf(fpout, "%.6e\n", val);
                val_cnt = 0;
              } else
                fprintf(fpout, "%.6e ", val);
            }
          }
        }
        if (val_cnt != 0) {
          fprintf(fpout, "\n");
          val_cnt = 0;
        }
      }
    }
  }
  return 0;
err:
  return -1;
}
```