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

```asm
<main>:
  endbr64
  push   %r12
  lea    D17(%rip),%rsi
  mov    $0x59,%ecx
  pxor   %xmm0,%xmm0
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x2f0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x2e8(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  movaps %xmm0,(%rsp)
  mov    %r12,%rdi
  rep movsq %ds:(%rsi),%es:(%rdi)
  movzbl (%rsi),%eax
  mov    %al,(%rdi)
  mov    $0x52,%eax
  jmp    L34
  nopl   0x0(%rax)
L39:
  mov    %r12,%rdi
  mov    %edx,%ebp
  call   <strlen@plt>
  cmp    %ebp,%eax
  jle    L45
L76:
  movslq %ebp,%rax
  movzbl 0x10(%rsp,%rax,1),%eax
L34:
  lea    0x1(%rbp),%edx
  cmp    $0x4c,%al
  je     L97
  cmp    $0x52,%al
  je     L18
  test   %al,%al
  jne    L39
L86:
  add    $0x3,%ebx
L93:
  movslq %edx,%rax
  and    $0x3,%ebx
  movsbl 0x10(%rsp,%rax,1),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  ja     L78
  lea    0x2(%rbp),%edx
  xor    %ecx,%ecx
  movslq %edx,%rdx
  nopw   0x0(%rax,%rax,1)
L79:
  lea    (%rcx,%rcx,4),%ecx
  mov    %edx,%ebp
  lea    -0x30(%rax,%rcx,2),%ecx
  movsbl (%r12,%rdx,1),%eax
  add    $0x1,%rdx
  lea    -0x30(%rax),%esi
  cmp    $0x9,%sil
  jbe    L79
L118:
  movslq %ebx,%rax
  mov    %r12,%rdi
  add    %ecx,(%rsp,%rax,4)
  call   <strlen@plt>
  cmp    %ebp,%eax
  jg     L76
L45:
  mov    (%rsp),%eax
  sub    0x8(%rsp),%eax
  lea    D3(%rip),%rdi
  mov    %eax,%esi
  neg    %esi
  cmovs  %eax,%esi
  mov    0x4(%rsp),%eax
  sub    0xc(%rsp),%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  add    %eax,%esi
  call   <printf@plt>
  mov    0x2e8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L22
  add    $0x2f0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L97:
  cmp    $0x52,%al
  jne    L86
L18:
  add    $0x1,%ebx
  jmp    L93
L78:
  mov    %edx,%ebp
  xor    %ecx,%ecx
  jmp    L118
L22:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D17
data_type: string
name: parse_data
arguments: tag: D3
data_type: string

tool: D17: R3, L5, R2, L1, L2, R5, L2, R2, L2, L2, L1, R2, L2, R4, R4, R1, L2, L3, R3, L1, R2, L2, L4, R4, R5, L3, R3, L3, L3, R4, R5, L3, R3, L5, L1, L2, R2, L1, R3, R1, L1, R187, L1, R2, R47, L5, L1, L2, R4, R3, L3, R3, R4, R1, R3, L1, L4, L1, R2, L1, R4, R5, L1, R77, L5, L4, R3, L2, R4, R5, R5, L2, L2, R2, R5, L2, R194, R5, L2, R4, L5, L4, L2, R5, L3, L2, L5, R5, R2, L3, R3, R1, L4, R2, L1, R5, L1, R5, L1, L1, R3, L1, R5, R2, R5, R5, L4, L5, L5, L5, R3, L2, L5, L4, R3, R1, R1, R4, L2, L4, R5, R5, R4, L2, L2, R5, R5, L5, L2, R4, R4, L4, R1, L3, R1, L1, L1, L1, L4, R5, R4, L4, L4, R5, R3, L2, L2, R3, R1, R4, L3, R1, L4, R3, L3, L2, R2, R2, R2, L1, L4, R3, R2, R2, L3, R2, L3, L2, R4, L2, R3, L4, R5, R4, R1, R5, R3

tool: D3: %d

assistant: ```c
void main() {
  char plan[] = "R3, L5, R2, L1, L2, R5, L2, R2, L2, L2, L1, R2, L2, R4, R4, R1, L2, L3, R3, L1, R2, L2, L4, R4, R5, L3, R3, L3, L3, R4, R5, L3, R3, L5, L1, L2, R2, L1, R3, R1, L1, R187, L1, R2, R47, L5, L1, L2, R4, R3, L3, R3, R4, R1, R3, L1, L4, L1, R2, L1, R4, R5, L1, R77, L5, L4, R3, L2, R4, R5, R5, L2, L2, R2, R5, L2, R194, R5, L2, R4, L5, L4, L2, R5, L3, L2, L5, R5, R2, L3, R3, R1, L4, R2, L1, R5, L1, R5, L1, L1, R3, L1, R5, R2, R5, R5, L4, L5, L5, L5, R3, L2, L5, L4, R3, R1, R1, R4, L2, L4, R5, R5, R4, L2, L2, R5, R5, L5, L2, R4, R4, L4, R1, L3, R1, L1, L1, L1, L4, R5, R4, L4, L4, R5, R3, L2, L2, R3, R1, R4, L3, R1, L4, R3, L3, L2, R2, R2, R2, L1, L4, R3, R2, R2, L3, R2, L3, L2, R4, L2, R3, L4, R5, R4, R1, R5, R3";
  int azimuth = 0;
  int distances[4] = {0, 0, 0, 0};
  int i = 0;
  do {
    if (plan[i] != 'L' && plan[i] != 'R' && plan[i] != '\0') {
      i++;
      continue;
    }
    if (plan[i] == 'R') {
      azimuth += 1;
    } else {
      azimuth += 3;
    }
    azimuth = azimuth % 4;
    i++;
    int distance = 0;
    while (plan[i] >= '0' && plan[i] <= '9') {
      distance = distance * 10 + plan[i] - '0';
      i++;
    }
    distances[azimuth] += distance;
  } while (i < strlen(plan));
  printf("%d", abs(distances[0] - distances[2]) + abs(distances[1] - distances[3]));
}
```