user: Translate the below assembly code into C programming language:

```asm
<run>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x18,%rsp
  movl   $0x0,-0x1c(%rbp)
  mov    $0x0,%eax
  call   <loc_x@plt>
  mov    %eax,-0x18(%rbp)
  mov    $0x0,%eax
  call   <loc_y@plt>
  mov    %eax,-0x14(%rbp)
  mov    D6(%rip),%eax
  test   %eax,%eax
  je     L217
  mov    D6(%rip),%eax
  cmp    $0x2,%eax
  jne    L96
L217:
  cmpl   $0x1f4,-0x14(%rbp)
  jle    L204
  mov    $0x3,%eax
  jmp    L252
L204:
  mov    $0x1,%eax
L252:
  mov    %eax,D12(%rip)
  jmp    L93
L96:
  cmpl   $0x1f4,-0x18(%rbp)
  jle    L189
  mov    $0x2,%eax
  jmp    L37
L189:
  mov    $0x0,%eax
L37:
  mov    %eax,D12(%rip)
L93:
  mov    D12(%rip),%eax
  cmp    $0x3,%eax
  je     L270
  cmp    $0x3,%eax
  ja     L164
  cmp    $0x2,%eax
  je     L57
  cmp    $0x2,%eax
  ja     L164
  test   %eax,%eax
  je     L320
  cmp    $0x1,%eax
  je     L55
  jmp    L164
L270:
  mov    $0x64,%esi
  mov    $0x5a,%edi
  call   <drive@plt>
  jmp    L15
L18:
  mov    $0x0,%eax
  call   <cycle@plt>
L15:
  mov    -0x14(%rbp),%eax
  lea    -0x63(%rax),%ebx
  mov    $0x0,%eax
  call   <loc_y@plt>
  cmp    %eax,%ebx
  jg     L250
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cmp    $0x63,%eax
  jle    L18
  jmp    L250
L55:
  mov    $0x64,%esi
  mov    $0x10e,%edi
  call   <drive@plt>
  jmp    L172
L86:
  mov    $0x0,%eax
  call   <cycle@plt>
L172:
  mov    -0x14(%rbp),%eax
  lea    0x63(%rax),%ebx
  mov    $0x0,%eax
  call   <loc_y@plt>
  cmp    %eax,%ebx
  jl     L266
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cmp    $0x63,%eax
  jle    L86
  jmp    L266
L57:
  mov    $0x64,%esi
  mov    $0xb4,%edi
  call   <drive@plt>
  jmp    L157
L119:
  mov    $0x0,%eax
  call   <cycle@plt>
L157:
  mov    -0x18(%rbp),%eax
  lea    -0x63(%rax),%ebx
  mov    $0x0,%eax
  call   <loc_x@plt>
  cmp    %eax,%ebx
  jg     L128
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cmp    $0x63,%eax
  jle    L119
  jmp    L128
L320:
  mov    $0x64,%esi
  mov    $0x0,%edi
  call   <drive@plt>
  jmp    L98
L163:
  mov    $0x0,%eax
  call   <cycle@plt>
L98:
  mov    -0x18(%rbp),%eax
  lea    0x63(%rax),%ebx
  mov    $0x0,%eax
  call   <loc_x@plt>
  cmp    %eax,%ebx
  jl     L105
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cmp    $0x63,%eax
  jle    L163
  jmp    L105
L250:
  nop
  jmp    L164
L266:
  nop
  jmp    L164
L128:
  nop
  jmp    L164
L105:
  nop
L164:
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <drive@plt>
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void run() {
  static enum { EAST, NORTH, WEST, SOUTH } last_dir;
  int x, y;
  int i = 0;
  x = loc_x();
  y = loc_y();
  if (last_dir == EAST || last_dir == WEST)
    last_dir = (y > 500 ? SOUTH : NORTH);
  else
    last_dir = (x > 500 ? WEST : EAST);
  switch (last_dir) {
  case SOUTH:
    drive(90, 100);
    while (y - 100 < loc_y() && i++ < 100)
      cycle();
    break;
  case NORTH:
    drive(270, 100);
    while (y + 100 > loc_y() && i++ < 100)
      cycle();
    break;
  case WEST:
    drive(180, 100);
    while (x - 100 < loc_x() && i++ < 100)
      cycle();
    break;
  case EAST:
    drive(0, 100);
    while (x + 100 > loc_x() && i++ < 100)
      cycle();
    break;
  }
  drive(0, 0);
}
```