user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    $0x1,%ebx
  lea    D39(%rip),%rbp
  lea    D13(%rip),%r12
  lea    D23(%rip),%r13
  jmp    L136
L130:
  movsd  0x10(%rsp),%xmm2
  movsd  0x20(%rsp),%xmm3
  movsd  0x18(%rsp),%xmm1
  subsd  %xmm2,%xmm1
  divsd  %xmm3,%xmm1
  movapd %xmm1,%xmm0
  mulsd  D19(%rip),%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  %xmm3,%xmm2
  addsd  %xmm2,%xmm0
  mov    %ebx,%esi
  mov    %r13,%rdi
  call   <printf@plt>
L115:
  add    $0x1,%ebx
L136:
  lea    0xc(%rsp),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  cmpl   $0x0,0xc(%rsp)
  je     L61
  lea    0x20(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    0xc(%rsp),%eax
  cmp    $0x1,%eax
  je     L130
  cmp    $0x2,%eax
  je     L21
  cmp    $0x3,%eax
  je     L51
  cmp    $0x4,%eax
  jne    L115
  mov    0x10(%rsp),%r14
  mov    0x18(%rsp),%r15
  movq   %r14,%xmm0
  mulsd  %xmm0,%xmm0
  movq   %r15,%xmm1
  addsd  %xmm1,%xmm1
  mulsd  0x20(%rsp),%xmm1
  subsd  %xmm1,%xmm0
  pxor   %xmm6,%xmm6
  ucomisd %xmm0,%xmm6
  ja     L102
  sqrtsd %xmm0,%xmm0
L112:
  movq   %r14,%xmm1
  subsd  %xmm0,%xmm1
  movq   %r15,%xmm7
  divsd  %xmm7,%xmm1
  mov    %ebx,%esi
  mov    %r13,%rdi
  call   <printf@plt>
  jmp    L115
L21:
  movsd  0x10(%rsp),%xmm2
  movsd  0x20(%rsp),%xmm0
  movsd  0x18(%rsp),%xmm1
  subsd  %xmm2,%xmm1
  divsd  %xmm0,%xmm1
  mulsd  D19(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm2
  addsd  %xmm2,%xmm0
  mov    %ebx,%esi
  mov    %r13,%rdi
  call   <printf@plt>
  jmp    L115
L51:
  mov    0x10(%rsp),%r15
  mov    0x18(%rsp),%r14
  movq   %r14,%xmm0
  addsd  %xmm0,%xmm0
  mulsd  0x20(%rsp),%xmm0
  movq   %r15,%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L131
  sqrtsd %xmm0,%xmm0
L101:
  movapd %xmm0,%xmm1
  movq   %r15,%xmm6
  subsd  %xmm6,%xmm1
  movq   %r14,%xmm7
  divsd  %xmm7,%xmm1
  mov    %ebx,%esi
  mov    %r13,%rdi
  call   <printf@plt>
  jmp    L115
L131:
  call   <sqrt@plt>
  jmp    L101
L102:
  call   <sqrt@plt>
  jmp    L112
L61:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L53:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D39
type_infered: string
name: read_data
arguments: label: D13
type_infered: string
name: read_data
arguments: label: D23
type_infered: string
name: read_data
arguments: label: D19
type_infered: byte[8]

tool: D39: %d

tool: D13: %lf %lf %lf

tool: D23: Case %d: %.3lf %.3lf


tool: {"D19": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
int main() {
  double b, c, d, u, v, a, t, s;
  int i, j, n;
  i = 1;
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    } else
      scanf("%lf %lf %lf", &b, &c, &d);
    if (n == 1) {
      u = b;
      v = c;
      t = d;
      a = (v - u) / t;
      s = u * t + .5 * a * t * t;
      printf("Case %d: %.3lf %.3lf\n", i, s, a);
    } else if (n == 2) {
      u = b;
      v = c;
      a = d;
      t = (v - u) / a;
      s = u * t + .5 * a * t * t;
      printf("Case %d: %.3lf %.3lf\n", i, s, t);
    } else if (n == 3) {
      u = b;
      a = c;
      s = d;
      v = sqrt(u * u + 2 * a * s);
      t = (v - u) / a;
      printf("Case %d: %.3lf %.3lf\n", i, v, t);
    } else if (n == 4) {
      v = b;
      a = c;
      s = d;
      u = sqrt(v * v - 2 * a * s);
      t = (v - u) / a;
      printf("Case %d: %.3lf %.3lf\n", i, u, t);
    }
    i++;
  }
  return 0;
}
```