user: Converte this assembly snippet into its equivalent C code:

```asm
<gen_2tri_stf>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x10,%rsp
  movss  (%r9),%xmm0
  comiss D67(%rip),%xmm0
  movss  D17(%rip),%xmm2
  jae    L75
  movss  D67(%rip),%xmm1
  comiss %xmm0,%xmm1
  jbe    L107
  comiss D35(%rip),%xmm0
  jbe    L107
  subss  %xmm0,%xmm1
  mulss  D8(%rip),%xmm1
  subss  %xmm1,%xmm2
  nopl   0x0(%rax,%rax,1)
L75:
  mov    %r12d,%esi
  mov    %rbx,%rdi
  movss  %xmm2,0xc(%rsp)
  call   <zapit@plt>
  movss  (%r14),%xmm0
  movss  D79(%rip),%xmm1
  mov    $0x2,%eax
  movss  0x0(%r13),%xmm4
  movsd  D56(%rip),%xmm3
  mulss  %xmm0,%xmm1
  movss  0xc(%rsp),%xmm2
  divss  %xmm4,%xmm0
  divss  %xmm4,%xmm1
  cvtss2sd %xmm0,%xmm0
  addsd  %xmm3,%xmm0
  cvttsd2si %xmm0,%esi
  movss  D47(%rip),%xmm0
  subss  %xmm2,%xmm0
  cvtss2sd %xmm1,%xmm1
  addsd  %xmm3,%xmm1
  pxor   %xmm3,%xmm3
  cvttsd2si %xmm1,%edx
  movss  D75(%rip),%xmm1
  cmp    %eax,%edx
  cmovl  %eax,%edx
  mov    $0x4,%eax
  cmp    %eax,%esi
  cvtsi2ss %edx,%xmm3
  cmovl  %eax,%esi
  movslq %edx,%rdi
  xor    %eax,%eax
  divss  %xmm3,%xmm1
  mulss  %xmm3,%xmm0
  cvttss2si %xmm0,%ecx
  nop
L76:
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  %xmm1,%xmm0
  movss  %xmm0,(%rbx,%rax,4)
  add    $0x1,%rax
  cmp    %rdi,%rax
  jne    L76
  cmp    %ecx,%edx
  jge    L28
  lea    (%rdx,%rdx,1),%edi
  lea    (%rbx,%rax,4),%rax
  sub    %ecx,%edi
  nopw   0x0(%rax,%rax,1)
L10:
  pxor   %xmm0,%xmm0
  add    $0x4,%rax
  cvtsi2ss %edx,%xmm0
  sub    $0x1,%edx
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x4(%rax)
  cmp    %edi,%edx
  jne    L10
L28:
  mov    %esi,%eax
  pxor   %xmm0,%xmm0
  movaps %xmm2,%xmm1
  sub    %ecx,%eax
  cvtsi2ss %eax,%xmm0
  divss  %xmm0,%xmm1
  cmp    %ecx,%esi
  jle    L53
  movslq %ecx,%rax
  sub    %esi,%ecx
  lea    (%rbx,%rax,4),%rdx
  xor    %eax,%eax
  xchg   %ax,%ax
L2:
  pxor   %xmm0,%xmm0
  add    $0x4,%rdx
  cvtsi2ss %eax,%xmm0
  sub    $0x1,%eax
  mulss  %xmm1,%xmm0
  addss  %xmm2,%xmm0
  movss  %xmm0,-0x4(%rdx)
  cmp    %ecx,%eax
  jne    L2
L53:
  lea    -0x1(%r12),%r8d
  pxor   %xmm1,%xmm1
  movslq %r8d,%rax
  ucomiss (%rbx,%rax,4),%xmm1
  jp     L190
  jne    L190
  test   %r8d,%r8d
  jne    L100
  jmp    L220
  cs nopw 0x0(%rax,%rax,1)
L183:
  sub    $0x1,%rax
  mov    %eax,%r8d
  test   %eax,%eax
  je     L220
L100:
  ucomiss -0x4(%rbx,%rax,4),%xmm1
  mov    %eax,%edx
  lea    -0x1(%rax),%r8d
  jp     L222
  je     L183
L222:
  test   %r8d,%r8d
  je     L220
  lea    0x1(%rdx),%eax
  cmp    %edx,%r12d
  cmovg  %eax,%r8d
L177:
  test   %r8d,%r8d
  jle    L77
  lea    -0x1(%r8),%eax
  movss  0x0(%r13),%xmm3
  movaps %xmm1,%xmm0
  lea    0x4(%rbx,%rax,4),%rdx
  mov    %rbx,%rax
  nopl   0x0(%rax,%rax,1)
L166:
  movss  (%rax),%xmm2
  add    $0x4,%rax
  mulss  %xmm3,%xmm2
  addss  %xmm2,%xmm0
  cmp    %rax,%rdx
  jne    L166
  comiss %xmm0,%xmm1
  jae    L77
  movss  0x0(%rbp),%xmm1
  divss  %xmm0,%xmm1
  nopl   0x0(%rax,%rax,1)
L3:
  movss  (%rbx),%xmm0
  add    $0x4,%rbx
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x4(%rbx)
  cmp    %rbx,%rdx
  jne    L3
L220:
  add    $0x10,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L107:
  movss  D89(%rip),%xmm2
  jmp    L75
  nopl   (%rax)
L77:
  add    $0x10,%rsp
  xor    %r8d,%r8d
  pop    %rbx
  mov    %r8d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L190:
  test   %r8d,%r8d
  jne    L177
  jmp    L220
```

tool_calls: name: read_data
arguments: tag: D67
type: f32
name: read_data
arguments: tag: D17
type: f32
name: read_data
arguments: tag: D35
type: f32
name: read_data
arguments: tag: D8
type: byte[4]
name: read_data
arguments: tag: D79
type: f32
name: read_data
arguments: tag: D56
type: f64
name: read_data
arguments: tag: D47
type: byte[4]
name: read_data
arguments: tag: D75
type: f32
name: read_data
arguments: tag: D89
type: byte[4]

tool: D67: 6

tool: D17: 0.2

tool: D35: 4

tool: {"D8": [0x9a,0x99,0x19,0xbe]}

tool: D79: 0.1

tool: D56: 0.5

tool: {"D47": [0x00,0x00,0x00,0x40]}

tool: D75: 1

tool: {"D89": [0x00,0x00,0x00,0x3f]}

assistant: ```c
int gen_2tri_stf(float *slip, float *trise, float *stf, int nt, float *dt, float *z0) {
  int it, nstf;
  int ip, it0, it1, it2;
  float tr, amp, a0;
  float sum;
  float alpha = 0.1;
  float betadeep = 0.2;
  float betashal = 0.5;
  float beta, dbdd;
  float dmin = 4.0;
  float dmax = 6.0;
  dbdd = (betadeep - betashal) / (dmax - dmin);
  if ((*z0) >= dmax)
    beta = betadeep;
  else if ((*z0) < dmax && (*z0) > dmin)
    beta = betadeep - (dmax - (*z0)) * dbdd;
  else
    beta = betashal;
  zapit(stf, nt);
  tr = (*trise);
  alpha = alpha * tr;
  it0 = (int)((alpha) / (*dt) + 0.5);
  if (it0 < 2)
    it0 = 2;
  it1 = (int)((tr) / (*dt) + 0.5);
  if (it1 < 4)
    it1 = 4;
  it2 = (2 - beta) * it0;
  a0 = 1.0;
  amp = a0 / (float)(it0);
  for (it = 0; it < it0; it++)
    stf[it] = it * amp;
  for (it = it0; it < it2; it++)
    stf[it] = (2 * it0 - it) * amp;
  amp = beta * a0 / (float)(it1 - it2);
  for (it = it2; it < it1; it++)
    stf[it] = beta * a0 + (it2 - it) * amp;
  nstf = nt - 1;
  while (stf[nstf] == (float)(0.0) && nstf)
    nstf--;
  if (nstf == 0)
    return (0);
  if (nstf < nt - 1)
    nstf = nstf + 2;
  ;
  sum = 0.0;
  for (it = 0; it < nstf; it++)
    sum = sum + (*dt) * stf[it];
  if (sum <= 0.0)
    return (0);
  sum = (*slip) / sum;
  for (it = 0; it < nstf; it++)
    stf[it] = stf[it] * sum;
  return (nstf);
}
```