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

```asm
<write_mesh_gmv_qual_mba>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  lea    D93(%rip),%rsi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %ecx,0x4(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %r9,0x8(%rsp)
  call   <fopen@plt>
  mov    %ebp,%edx
  lea    D42(%rip),%rsi
  mov    %rax,%r12
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  test   %ebp,%ebp
  jle    L221
  lea    -0x1(%rbp),%eax
  mov    %rbx,%r14
  lea    D21(%rip),%rbp
  lea    (%rax,%rax,2),%rax
  lea    0x18(%rbx,%rax,8),%r13
  nopl   0x0(%rax)
L122:
  movsd  0x10(%r14),%xmm2
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x18,%r14
  movsd  -0x10(%r14),%xmm1
  movsd  -0x18(%r14),%xmm0
  mov    $0x3,%eax
  call   <fprintf@plt>
  cmp    %r13,%r14
  jne    L122
L221:
  mov    0x70(%rsp),%edx
  lea    D28(%rip),%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    0x70(%rsp),%r10d
  test   %r10d,%r10d
  jle    L169
  mov    0x70(%rsp),%eax
  mov    0x78(%rsp),%r14
  mov    %rbx,0x18(%rsp)
  xor    %ebp,%ebp
  mov    0x80(%rsp),%r15
  lea    D104(%rip),%r13
  sub    $0x1,%eax
  shl    $0x4,%rax
  mov    %r15,%rbx
  lea    0x10(%r14,%rax,1),%rax
  mov    %rax,0x10(%rsp)
  xor    %eax,%eax
  mov    %eax,%r15d
  xchg   %ax,%ax
L241:
  mov    0x4(%r14),%ecx
  mov    0xc(%r14),%r9d
  xor    %eax,%eax
  mov    %r13,%rsi
  mov    0x8(%r14),%r8d
  mov    (%r14),%edx
  mov    %r12,%rdi
  call   <fprintf@plt>
  mov    (%rbx),%eax
  cmp    %eax,%ebp
  cmovl  %eax,%ebp
  test   %eax,%eax
  mov    $0x1,%eax
  cmove  %eax,%r15d
  add    $0x10,%r14
  add    $0x4,%rbx
  cmp    0x10(%rsp),%r14
  jne    L241
  mov    0x4(%rsp),%eax
  mov    0x18(%rsp),%rbx
  mov    %r15d,0x10(%rsp)
  test   %eax,%eax
  jle    L288
L1:
  mov    0x4(%rsp),%ecx
  lea    -0x1(%rcx),%eax
  cmp    $0x5,%eax
  jbe    L256
  movd   %ebp,%xmm7
  shr    $0x2,%ecx
  mov    0x8(%rsp),%rdi
  pxor   %xmm1,%xmm1
  pshufd $0x0,%xmm7,%xmm4
  mov    %ecx,%edx
  movd   0x10(%rsp),%xmm7
  movdqa D177(%rip),%xmm5
  sub    $0x1,%edx
  mov    %rdi,%rax
  movdqa %xmm1,%xmm6
  movdqa D139(%rip),%xmm8
  pshufd $0x0,%xmm7,%xmm2
  shl    $0x4,%rdx
  movdqa D220(%rip),%xmm7
  lea    0x10(%rdi,%rdx,1),%rdx
  nopl   0x0(%rax)
L110:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  movdqa %xmm0,%xmm3
  movdqa %xmm0,%xmm9
  pcmpeqd %xmm6,%xmm0
  pcmpgtd %xmm4,%xmm3
  pcmpeqd %xmm6,%xmm0
  pand   %xmm3,%xmm9
  pandn  %xmm4,%xmm3
  movdqa %xmm3,%xmm4
  por    %xmm9,%xmm4
  movdqa %xmm0,%xmm3
  pand   %xmm0,%xmm2
  pand   %xmm0,%xmm1
  pandn  %xmm8,%xmm3
  pandn  %xmm5,%xmm0
  paddd  %xmm7,%xmm5
  por    %xmm3,%xmm2
  por    %xmm0,%xmm1
  cmp    %rdx,%rax
  jne    L110
  pshufd $0x55,%xmm1,%xmm0
  movd   %xmm1,%edi
  movd   %xmm1,%esi
  movd   %xmm0,%eax
  movdqa %xmm1,%xmm0
  cmp    %edi,%eax
  punpckhdq %xmm1,%xmm0
  cmovae %eax,%esi
  movd   %xmm0,%ecx
  pshufd $0xff,%xmm2,%xmm0
  movd   %xmm0,%ebp
  cmp    %esi,%ecx
  jbe    L91
  punpckhdq %xmm2,%xmm2
  movd   %xmm2,%edx
L126:
  pshufd $0xff,%xmm1,%xmm1
  cmp    %esi,%ecx
  movd   %xmm1,%eax
  movdqa %xmm4,%xmm1
  cmovb  %esi,%ecx
  psrldq $0x8,%xmm1
  movdqa %xmm1,%xmm0
  cmp    %ecx,%eax
  mov    0x4(%rsp),%ecx
  pcmpgtd %xmm4,%xmm0
  cmova  %ebp,%edx
  mov    %ecx,%eax
  and    $0xfffffffc,%eax
  and    $0x3,%ecx
  mov    %edx,0x10(%rsp)
  pand   %xmm0,%xmm1
  pandn  %xmm4,%xmm0
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm2
  psrldq $0x4,%xmm2
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm2
  pandn  %xmm0,%xmm1
  por    %xmm2,%xmm1
  movd   %xmm1,%ebp
  je     L331
L264:
  mov    0x8(%rsp),%r10
  movslq %eax,%rdx
  mov    0x10(%rsp),%edi
  lea    0x0(,%rdx,4),%rcx
  mov    0x4(%rsp),%r11d
  mov    (%r10,%rdx,4),%esi
  mov    $0x1,%edx
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  test   %esi,%esi
  lea    0x1(%rax),%esi
  cmove  %edx,%edi
  mov    %edi,0x10(%rsp)
  cmp    %r11d,%esi
  jge    L331
  mov    0x4(%r10,%rcx,1),%esi
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  test   %esi,%esi
  lea    0x2(%rax),%esi
  cmove  %edx,%edi
  mov    %edi,0x10(%rsp)
  cmp    %esi,%r11d
  jle    L331
  mov    0x8(%r10,%rcx,1),%esi
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  test   %esi,%esi
  lea    0x3(%rax),%esi
  cmove  %edx,%edi
  mov    %edi,0x10(%rsp)
  cmp    %esi,%r11d
  jle    L331
  mov    0xc(%r10,%rcx,1),%esi
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  test   %esi,%esi
  lea    0x4(%rax),%esi
  cmove  %edx,%edi
  mov    %edi,0x10(%rsp)
  cmp    %r11d,%esi
  jge    L331
  mov    0x10(%r10,%rcx,1),%esi
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  test   %esi,%esi
  cmove  %edx,%edi
  add    $0x5,%eax
  mov    %edi,0x10(%rsp)
  cmp    %eax,%r11d
  jle    L331
  mov    0x14(%r10,%rcx,1),%eax
  cmp    %eax,%ebp
  cmovl  %eax,%ebp
  test   %eax,%eax
  cmovne %edi,%edx
  mov    %edx,0x10(%rsp)
L331:
  mov    0x70(%rsp),%edx
  test   %edx,%edx
  jne    L288
  mov    %r12,%rcx
  mov    $0xb,%edx
  mov    $0x1,%esi
  lea    D210(%rip),%rdi
  call   <fwrite@plt>
L337:
  add    0x10(%rsp),%ebp
  xor    %r14d,%r14d
  mov    0x20(%rsp),%r15
  lea    D135(%rip),%r13
  mov    %ebp,%eax
  mov    %rbx,%rbp
  mov    %r14,%rbx
  mov    %eax,%r14d
  nopl   0x0(%rax)
L289:
  mov    0x8(%rsp),%rax
  lea    D65(%rip),%rsi
  mov    %r12,%rdi
  mov    (%rax,%rbx,4),%edx
  test   %edx,%edx
  cmove  %r14d,%edx
  xor    %eax,%eax
  add    $0x1,%rbx
  add    $0xc,%r15
  call   <fprintf@plt>
  mov    -0x4(%r15),%eax
  mov    -0xc(%r15),%esi
  mov    %r12,%rdi
  lea    (%rax,%rax,2),%edx
  mov    -0x8(%r15),%eax
  lea    (%rsi,%rsi,2),%esi
  movslq %edx,%rdx
  movslq %esi,%rsi
  lea    (%rax,%rax,2),%eax
  movsd  -0x18(%rbp,%rsi,8),%xmm0
  movsd  -0x18(%rbp,%rdx,8),%xmm2
  lea    D92(%rip),%rsi
  cltq
  movsd  -0x18(%rbp,%rax,8),%xmm1
  mov    $0x3,%eax
  call   <fprintf@plt>
  mov    -0x4(%r15),%eax
  mov    -0xc(%r15),%esi
  mov    %r12,%rdi
  lea    0x1(%rax,%rax,2),%edx
  mov    -0x8(%r15),%eax
  lea    0x1(%rsi,%rsi,2),%esi
  movslq %edx,%rdx
  movslq %esi,%rsi
  lea    0x1(%rax,%rax,2),%eax
  movsd  -0x18(%rbp,%rsi,8),%xmm0
  movsd  -0x18(%rbp,%rdx,8),%xmm2
  mov    %r13,%rsi
  cltq
  movsd  -0x18(%rbp,%rax,8),%xmm1
  mov    $0x3,%eax
  call   <fprintf@plt>
  mov    -0x4(%r15),%eax
  mov    -0xc(%r15),%esi
  mov    %r12,%rdi
  lea    0x2(%rax,%rax,2),%edx
  mov    -0x8(%r15),%eax
  lea    0x2(%rsi,%rsi,2),%esi
  movslq %edx,%rdx
  movslq %esi,%rsi
  lea    0x2(%rax,%rax,2),%eax
  movsd  -0x18(%rbp,%rsi,8),%xmm0
  movsd  -0x18(%rbp,%rdx,8),%xmm2
  mov    %r13,%rsi
  cltq
  movsd  -0x18(%rbp,%rax,8),%xmm1
  mov    $0x3,%eax
  call   <fprintf@plt>
  cmp    %ebx,0x4(%rsp)
  jg     L289
L36:
  mov    %r12,%rcx
  mov    $0x8,%edx
  mov    $0x1,%esi
  lea    D13(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x7,%edx
  mov    $0x1,%esi
  lea    D237(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L91:
  pshufd $0x55,%xmm2,%xmm0
  movd   %xmm2,%edx
  cmp    %edi,%eax
  movd   %xmm0,%r8d
  cmova  %r8d,%edx
  jmp    L126
  nopl   0x0(%rax)
L288:
  mov    0x10(%rsp),%eax
  lea    D7(%rip),%rsi
  mov    %r12,%rdi
  lea    0x0(%rbp,%rax,1),%r14d
  xor    %eax,%eax
  mov    %r14d,%edx
  call   <fprintf@plt>
  test   %ebp,%ebp
  je     L47
  xor    %r15d,%r15d
  lea    D49(%rip),%r13
  nopl   0x0(%rax,%rax,1)
L228:
  add    $0x1,%r15d
  xor    %eax,%eax
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    %r15d,%edx
  call   <fprintf@plt>
  cmp    %ebp,%r15d
  jne    L228
L47:
  mov    0x10(%rsp),%r8d
  test   %r8d,%r8d
  jne    L181
L17:
  mov    0x70(%rsp),%edi
  test   %edi,%edi
  jle    L153
  mov    0x70(%rsp),%eax
  mov    0x80(%rsp),%r15
  lea    D47(%rip),%r13
  sub    $0x1,%eax
  mov    %rax,0x28(%rsp)
  lea    0x4(%r15,%rax,4),%rax
  mov    %rax,0x18(%rsp)
L226:
  mov    (%r15),%edx
  test   %edx,%edx
  jne    L242
  mov    %r14d,%edx
L242:
  mov    %r13,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x4,%r15
  call   <fprintf@plt>
  cmp    0x18(%rsp),%r15
  jne    L226
  mov    %r12,%rcx
  mov    $0x12,%edx
  mov    $0x1,%esi
  lea    D171(%rip),%rdi
  lea    D121(%rip),%r13
  call   <fwrite@plt>
  mov    0x28(%rsp),%rax
  mov    0x78(%rsp),%r15
  shl    $0x4,%rax
  lea    0x10(%r15,%rax,1),%r14
  nopl   (%rax)
L81:
  mov    0x4(%r15),%edi
  mov    0xc(%r15),%eax
  add    $0x10,%r15
  mov    -0x8(%r15),%ecx
  lea    -0x1(%rdi),%edx
  mov    -0x10(%r15),%edi
  lea    -0x1(%rax),%r8d
  sub    $0x1,%ecx
  lea    -0x1(%rdi),%esi
  mov    %rbx,%rdi
  call   <aft_tetra_qual_mba@plt>
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <fprintf@plt>
  cmp    %r14,%r15
  jne    L81
L75:
  mov    %r12,%rcx
  mov    $0x9,%edx
  mov    $0x1,%esi
  lea    D136(%rip),%rdi
  call   <fwrite@plt>
  mov    $0x1,%esi
  mov    %r12,%rcx
  mov    $0xb,%edx
  lea    D210(%rip),%rdi
  call   <fwrite@plt>
  mov    0x4(%rsp),%esi
  test   %esi,%esi
  jg     L337
  jmp    L36
  nopl   0x0(%rax,%rax,1)
L169:
  mov    0x4(%rsp),%r9d
  test   %r9d,%r9d
  jg     L62
  mov    0x70(%rsp),%ecx
  test   %ecx,%ecx
  jne    L265
  mov    %r12,%rcx
  mov    $0xb,%edx
  mov    $0x1,%esi
  lea    D210(%rip),%rdi
  call   <fwrite@plt>
  jmp    L36
L181:
  mov    %r12,%rcx
  mov    $0x8,%edx
  mov    $0x1,%esi
  lea    D122(%rip),%rdi
  call   <fwrite@plt>
  jmp    L17
L256:
  xor    %eax,%eax
  jmp    L264
L62:
  movl   $0x0,0x10(%rsp)
  xor    %ebp,%ebp
  jmp    L1
L153:
  mov    %r12,%rcx
  mov    $0x12,%edx
  mov    $0x1,%esi
  lea    D171(%rip),%rdi
  call   <fwrite@plt>
  jmp    L75
L265:
  xor    %edx,%edx
  lea    D7(%rip),%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  xor    %ebp,%ebp
  xor    %r14d,%r14d
  movl   $0x0,0x10(%rsp)
  jmp    L17
```

tool_calls: name: parse_data
arguments: label: D93
data_type: string
name: parse_data
arguments: label: D42
data_type: string
name: parse_data
arguments: label: D21
data_type: string
name: parse_data
arguments: label: D28
data_type: string
name: parse_data
arguments: label: D104
data_type: string
name: parse_data
arguments: label: D177
data_type: byte[16]
name: parse_data
arguments: label: D139
data_type: byte[16]
name: parse_data
arguments: label: D220
data_type: byte[16]
name: parse_data
arguments: label: D210
data_type: string
name: parse_data
arguments: label: D135
data_type: string
name: parse_data
arguments: label: D65
data_type: string
name: parse_data
arguments: label: D92
data_type: string
name: parse_data
arguments: label: D13
data_type: string
name: parse_data
arguments: label: D237
data_type: string
name: parse_data
arguments: label: D7
data_type: string
name: parse_data
arguments: label: D49
data_type: string
name: parse_data
arguments: label: D47
data_type: string
name: parse_data
arguments: label: D171
data_type: string
name: parse_data
arguments: label: D121
data_type: string
name: parse_data
arguments: label: D136
data_type: string
name: parse_data
arguments: label: D122
data_type: string

tool: D93: w

tool: D42: gmvinput ascii

nodev %5d


tool: D21:   %20.15lf %20.15lf %20.15lf


tool: D28: 
cells %5d


tool: D104:  tet 4
  %4d %4d %4d %4d


tool: {"D177": [0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D139": [0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00]}

tool: {"D220": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: D210: 

polygons


tool: D135:       %20.15lf %20.15lf %20.15lf


tool: D65: %3d 3

tool: D92:  %20.15lf %20.15lf %20.15lf


tool: D13: endpoly


tool: D237: 
endgmv

tool: D7: 
material %d 0


tool: D49: mat%d


tool: D47:  %2d

tool: D171: 

variable
qual 0


tool: D121:  %20.15lf

tool: D136: 
endvars


tool: D122: unknown


assistant: ```c
int write_mesh_gmv_qual_mba(char *fn, int nV, double *vertex, int nF, int *face, int *facematerial, int nT, int *tetra, int *tetramaterial) {
  int i, mmax = 0, unkmat = 0;
  FILE *f;
  f = fopen(fn, "w");
  fprintf(f, "gmvinput ascii\n\nnodev %5d\n", nV);
  for (i = 0; i < nV; i++) {
    fprintf(f, "  %20.15lf %20.15lf %20.15lf\n", vertex[3 * i + 0], vertex[3 * i + 1], vertex[3 * i + 2]);
  }
  fprintf(f, "\ncells %5d\n", nT);
  for (i = 0; i < nT; i++) {
    fprintf(f, " tet 4\n  %4d %4d %4d %4d\n", tetra[4 * i + 0], tetra[4 * i + 1], tetra[4 * i + 2], tetra[4 * i + 3]);
    if (mmax < tetramaterial[i])
      mmax = tetramaterial[i];
    if (tetramaterial[i] == 0)
      unkmat = 1;
  }
  for (i = 0; i < nF; i++) {
    if (mmax < facematerial[i])
      mmax = facematerial[i];
    if (facematerial[i] == 0)
      unkmat = 1;
  }
  if (nT) {
    fprintf(f, "\nmaterial %d 0\n", mmax + unkmat);
    for (i = 0; i < mmax; i++)
      fprintf(f, "mat%d\n", i + 1);
    if (unkmat)
      fprintf(f, "unknown\n");
    for (i = 0; i < nT; i++) {
      fprintf(f, " %2d", (tetramaterial[i]) ? tetramaterial[i] : mmax + unkmat);
    }
    fprintf(f, "\n\nvariable\nqual 0\n");
    for (i = 0; i < nT; i++) {
      fprintf(f, " %20.15lf", aft_tetra_qual_mba(vertex, tetra[4 * i + 0] - 1, tetra[4 * i + 1] - 1, tetra[4 * i + 2] - 1, tetra[4 * i + 3] - 1));
    }
    fprintf(f, "\nendvars\n");
  }
  fprintf(f, "\n\npolygons\n");
  for (i = 0; i < nF; i++) {
    fprintf(f, "%3d 3", (facematerial[i]) ? facematerial[i] : mmax + unkmat);
    fprintf(f, " %20.15lf %20.15lf %20.15lf\n", vertex[3 * face[3 * i + 0] + 0 - 3], vertex[3 * face[3 * i + 1] + 0 - 3], vertex[3 * face[3 * i + 2] + 0 - 3]);
    fprintf(f, "      %20.15lf %20.15lf %20.15lf\n", vertex[3 * face[3 * i + 0] + 1 - 3], vertex[3 * face[3 * i + 1] + 1 - 3], vertex[3 * face[3 * i + 2] + 1 - 3]);
    fprintf(f, "      %20.15lf %20.15lf %20.15lf\n", vertex[3 * face[3 * i + 0] + 2 - 3], vertex[3 * face[3 * i + 1] + 2 - 3], vertex[3 * face[3 * i + 2] + 2 - 3]);
  }
  fprintf(f, "endpoly\n");
  fprintf(f, "\nendgmv");
  fclose(f);
  return 0;
}
```