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

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xf(%rsp),%rcx
  lea    0xe(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  lea    D68(%rip),%rdi
  call   <scanf@plt>
  movzbl 0xe(%rsp),%eax
  cmp    $0x69,%al
  je     L46
  cmp    $0x6d,%al
  je     L71
  cmp    $0x79,%al
  je     L295
  cmp    $0x66,%al
  je     L102
  movzbl 0xf(%rsp),%edx
  cmp    $0x69,%dl
  je     L115
  mov    $0x0,%eax
  jmp    L35
L235:
  mov    $0x3,%edx
  jmp    L282
L115:
  mov    $0x1,%edx
  mov    $0x0,%eax
  jmp    L155
L240:
  mov    $0x1,%edx
  jmp    L155
L272:
  mov    $0x4,%edx
  jmp    L155
L157:
  divsd  D11(%rip),%xmm0
  mov    %edi,%eax
L289:
  mov    $0x1,%ecx
  cmp    %edx,%eax
  je     L119
L11:
  cmp    %edx,%eax
  jge    L188
  cmp    $0x2,%eax
  je     L103
  cmp    $0x3,%eax
  je     L277
  cmp    $0x1,%eax
  je     L157
L119:
  test   %cl,%cl
  je     L138
  movsd  %xmm0,0x10(%rsp)
L138:
  movsd  0x10(%rsp),%xmm0
  lea    D65(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L142
  mov    $0x0,%eax
  add    $0x28,%rsp
  ret
L103:
  divsd  D62(%rip),%xmm0
  mov    %esi,%eax
  jmp    L289
L277:
  divsd  D57(%rip),%xmm0
  mov    %r8d,%eax
  jmp    L289
L188:
  cmp    $0x3,%eax
  je     L164
  cmp    $0x4,%eax
  je     L292
  cmp    $0x2,%eax
  jne    L119
  mulsd  D11(%rip),%xmm0
  mov    %r9d,%eax
  jmp    L289
L292:
  mulsd  D57(%rip),%xmm0
  mov    %esi,%eax
  jmp    L289
L164:
  mulsd  D62(%rip),%xmm0
  mov    %edi,%eax
  jmp    L289
L46:
  movzbl 0xf(%rsp),%edx
  cmp    $0x69,%dl
  je     L138
  mov    $0x1,%eax
L35:
  cmp    $0x6d,%dl
  je     L272
L76:
  cmp    $0x79,%dl
  je     L235
  cmp    $0x66,%dl
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%edx
L282:
  cmp    %eax,%edx
  je     L138
L155:
  movsd  0x10(%rsp),%xmm0
  mov    $0x0,%ecx
  mov    $0x2,%edi
  mov    $0x3,%esi
  mov    $0x1,%r9d
  mov    $0x4,%r8d
  jmp    L11
L71:
  mov    $0x4,%eax
  jmp    L110
L295:
  mov    $0x3,%eax
L110:
  movzbl 0xf(%rsp),%edx
  cmp    $0x69,%dl
  je     L240
  cmp    $0x6d,%dl
  jne    L76
  mov    $0x4,%edx
  jmp    L282
L102:
  mov    $0x2,%eax
  jmp    L110
L142:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D68
datatype: string
name: parse_data
arguments: data_label: D11
datatype: byte[8]
name: parse_data
arguments: data_label: D65
datatype: string
name: parse_data
arguments: data_label: D62
datatype: byte[8]
name: parse_data
arguments: data_label: D57
datatype: byte[8]

tool: D68: %lf %c %c

tool: {"D11": [0x00,0x00,0x00,0x00,0x00,0x00,0x28,0x40]}

tool: D65: %.6lf


tool: {"D62": [0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40]}

tool: {"D57": [0x00,0x00,0x00,0x00,0x00,0x80,0x9b,0x40]}

assistant: ```c
int main(void) {
  double amount;
  char fromUnit, toUnit;
  int from = 0, to = 0;
  scanf("%lf %c %c", &amount, &fromUnit, &toUnit);
  if (fromUnit == 'i')
    from = 1;
  else if (fromUnit == 'f')
    from = 2;
  else if (fromUnit == 'y')
    from = 3;
  else if (fromUnit == 'm')
    from = 4;
  else
    from = 0;
  if (toUnit == 'i')
    to = 1;
  else if (toUnit == 'f')
    to = 2;
  else if (toUnit == 'y')
    to = 3;
  else if (toUnit == 'm')
    to = 4;
  else
    to = 0;
  while (1) {
    if (from == to) {
      printf("%.6lf\n", amount);
      return 0;
    }
    if (to > from) {
      switch (from) {
      case 1:
        amount /= 12;
        from++;
        break;
      case 2:
        amount /= 3;
        from++;
        break;
      case 3:
        amount /= 1760;
        from++;
        break;
      default:
        from = to;
        break;
      }
    } else {
      switch (from) {
      case 4:
        amount *= 1760;
        from--;
        break;
      case 3:
        amount *= 3;
        from--;
        break;
      case 2:
        amount *= 12;
        from--;
        break;
      default:
        from = to;
        break;
      }
    }
  }
}
```