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

```asm
<main>:
  endbr64
  push   %r12
  lea    D3(%rip),%rsi
  mov    $0x59,%ecx
  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
  movq   $0x0,(%rsp)
  movq   $0x0,0x8(%rsp)
  mov    %r12,%rdi
  rep movsq %ds:(%rsi),%es:(%rdi)
  movzbl (%rsi),%eax
  mov    %al,(%rdi)
  mov    $0x52,%eax
  jmp    L73
  nopw   0x0(%rax,%rax,1)
L95:
  mov    %r12,%rdi
  mov    %edx,%ebp
  call   <strlen@plt>
  cmp    %ebp,%eax
  jle    L44
L103:
  movslq %ebp,%rax
  movzbl 0x10(%rsp,%rax,1),%eax
L73:
  lea    0x1(%rbp),%edx
  cmp    $0x4c,%al
  je     L60
  cmp    $0x52,%al
  je     L109
  test   %al,%al
  jne    L95
L26:
  add    $0x3,%ebx
L57:
  movslq %edx,%rax
  and    $0x3,%ebx
  movsbl 0x10(%rsp,%rax,1),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  ja     L87
  lea    0x2(%rbp),%edx
  xor    %ecx,%ecx
  movslq %edx,%rdx
  nop
L53:
  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    L53
L76:
  movslq %ebx,%rax
  mov    %r12,%rdi
  add    %ecx,(%rsp,%rax,4)
  call   <strlen@plt>
  cmp    %ebp,%eax
  jg     L103
L44:
  mov    (%rsp),%eax
  sub    0x8(%rsp),%eax
  lea    D0(%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    L70
  add    $0x2f0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L60:
  cmp    $0x52,%al
  jne    L26
L109:
  add    $0x1,%ebx
  jmp    L57
L87:
  mov    %edx,%ebp
  xor    %ecx,%ecx
  jmp    L76
L70:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D3
type: string
name: retrieve_data
arguments: data_label: D0
type: string

tool: D3: 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: D0: %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]));
}
```