user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <wake@plt>
  mov    $0x2,%ebp
  lea    D8(%rip),%r12
  mov    $0x5,%r15d
  lea    D19(%rip),%r14
  lea    D7(%rip),%r13
  jmp    L277
L453:
  mov    %r14,%rdi
  call   <printf@plt>
  jmp    L78
L301:
  mov    $0x1f4,%edi
  call   <msleep@plt>
L78:
  mov    $0x0,%eax
  call   <a_button@plt>
  test   %eax,%eax
  je     L301
  mov    %r13,%rdi
  call   <printf@plt>
  mov    $0x5,%ebp
  jmp    L277
  mov    $0x0,%eax
  call   <steer_center@plt>
  mov    $0x0,%eax
  call   <drive_forward@plt>
  mov    $0xa,%ebp
L277:
  mov    $0x0,%eax
  call   <b_button@plt>
  test   %eax,%eax
  jne    L166
  mov    $0x2,%edi
  call   <clear_motor_position_counter@plt>
  mov    $0x2,%edi
  call   <get_motor_position_counter@plt>
  mov    %eax,%ebx
  cmp    $0x2,%ebp
  je     L453
  lea    -0x5(%rbp),%eax
  cmp    $0x19,%eax
  ja     L277
  mov    %eax,%eax
  movslq (%r12,%rax,4),%rax
  add    %r12,%rax
  notrack jmp *%rax
  mov    $0x0,%eax
  call   <steer_center@plt>
  mov    $0x2,%edi
  call   <detect_straight@plt>
  test   %rax,%rax
  je     L25
  mov    $0x19,%ebp
  jmp    L277
L25:
  mov    $0x2,%edi
  call   <get_motor_position_counter@plt>
  cmp    %ebx,%eax
  jg     L61
  mov    $0x1e,%ebp
  jmp    L277
L61:
  mov    $0x1,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  je     L322
  mov    $0x3,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  jne    L393
L322:
  mov    $0x1,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  je     L321
  mov    $0xf,%ebp
  jmp    L277
L321:
  mov    $0x3,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  mov    $0x14,%eax
  cmovne %eax,%ebp
  jmp    L277
  mov    $0x0,%eax
  call   <steer_right@plt>
  mov    $0x2,%edi
  call   <detect_straight@plt>
  test   %rax,%rax
  je     L28
  mov    $0x19,%ebp
  jmp    L277
L28:
  mov    $0x2,%edi
  call   <get_motor_position_counter@plt>
  cmp    %ebx,%eax
  jg     L186
  mov    $0x1e,%ebp
  jmp    L277
L186:
  mov    $0x1,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  je     L48
  mov    $0x3,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  jne    L343
L48:
  mov    $0x1,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  je     L236
  mov    $0xf,%ebp
  jmp    L277
L236:
  mov    $0x3,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  mov    $0xa,%eax
  cmove  %eax,%ebp
  jmp    L277
  mov    $0x0,%eax
  call   <steer_left@plt>
  mov    $0x2,%edi
  call   <detect_straight@plt>
  test   %rax,%rax
  je     L314
  mov    $0x19,%ebp
  jmp    L277
L314:
  mov    $0x2,%edi
  call   <get_motor_position_counter@plt>
  cmp    %ebx,%eax
  jg     L38
  mov    $0x1e,%ebp
  jmp    L277
L38:
  mov    $0x1,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  je     L103
  mov    $0x3,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  jne    L432
L103:
  mov    $0x1,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  jne    L277
  mov    $0x3,%edi
  call   <detect_side@plt>
  cmp    $0x1,%rax
  sbb    %ebp,%ebp
  and    $0xfffffff6,%ebp
  add    $0x14,%ebp
  jmp    L277
  mov    $0x0,%eax
  call   <drive_stop@plt>
  mov    $0x0,%eax
  call   <rand@plt>
  test   $0x1,%al
  je     L254
  mov    $0x0,%eax
  call   <steer_right@plt>
L384:
  mov    $0x0,%eax
  call   <drive_reverse@plt>
  mov    $0x0,%edi
  call   <detect_straight@plt>
  test   %rax,%rax
  je     L11
L46:
  mov    $0x0,%edi
  call   <detect_straight@plt>
  test   %rax,%rax
  je     L57
L345:
  mov    $0x0,%eax
  call   <drive_stop@plt>
  mov    $0x2,%edi
  call   <detect_straight@plt>
  test   %rax,%rax
  jne    L277
  mov    $0x1,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  jne    L275
  mov    $0x5,%ebp
  jmp    L277
L254:
  mov    $0x0,%eax
  call   <steer_left@plt>
  jmp    L384
L11:
  mov    $0x1,%edi
  call   <sleep@plt>
  jmp    L46
L57:
  mov    $0x1,%edi
  call   <sleep@plt>
  jmp    L345
L275:
  mov    $0x3,%edi
  call   <detect_side@plt>
  test   %rax,%rax
  cmove  %r15d,%ebp
  jmp    L277
  mov    $0x0,%eax
  call   <drive_stop@plt>
  mov    $0x0,%eax
  call   <steer_center@plt>
  mov    $0x2,%ebp
  jmp    L277
L393:
  mov    $0x19,%ebp
  jmp    L277
L343:
  mov    $0x19,%ebp
  jmp    L277
L432:
  mov    $0x19,%ebp
  jmp    L277
L166:
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D19
type_infered: string
name: extract_symbolic_data
arguments: tag: D7
type_infered: string

tool: D19: Waiting for A button to go. 


tool: D7: Press B button to stop. 


assistant: ```c
int main() {
  int mpos_count = 0;
  int avoid_count = 0;
  int state = 0;
  wake();
  state = 2;
  while (!b_button()) {
    clear_motor_position_counter(2);
    mpos_count = get_motor_position_counter(2);
    if (2 == state) {
      printf("Waiting for A button to go. \n");
      while (!a_button()) {
        msleep(500);
      }
      printf("Press B button to stop. \n");
      state = 5;
    } else if (5 == state) {
      avoid_count = 0;
      steer_center();
      drive_forward();
      state = 10;
    } else if (10 == state) {
      steer_center();
      if (detect_straight(2)) {
        state = 25;
      } else if (mpos_count >= get_motor_position_counter(2)) {
        state = 30;
      } else if (detect_side(1) && detect_side(3)) {
        state = 25;
      } else if (detect_side(1)) {
        state = 15;
      } else if (detect_side(3)) {
        state = 20;
      } else {
        state = 10;
      }
    } else if (20 == state) {
      steer_right();
      if (detect_straight(2)) {
        state = 25;
      } else if (mpos_count >= get_motor_position_counter(2)) {
        state = 30;
      } else if (detect_side(1) && detect_side(3)) {
        state = 25;
      } else if (detect_side(1)) {
        state = 15;
      } else if (detect_side(3)) {
        state = 20;
      } else {
        state = 10;
      }
    } else if (15 == state) {
      steer_left();
      if (detect_straight(2)) {
        state = 25;
      } else if (mpos_count >= get_motor_position_counter(2)) {
        state = 30;
      } else if (detect_side(1) && detect_side(3)) {
        state = 25;
      } else if (detect_side(1)) {
        state = 15;
      } else if (detect_side(3)) {
        state = 20;
      } else {
        state = 10;
      }
    } else if (25 == state) {
      avoid_count = 0;
      drive_stop();
      if ((rand() % 2)) {
        steer_right();
      } else {
        steer_left();
      }
      drive_reverse();
      if (!detect_straight(0)) {
        sleep(1);
      }
      if (!detect_straight(0)) {
        sleep(1);
      }
      drive_stop();
      if (avoid_count > 3) {
        state = 30;
      } else if (detect_straight(2)) {
        state = 25;
      } else if (detect_side(1) && detect_side(3)) {
        state = 25;
      } else {
        state = 5;
      }
    } else if (30 == state) {
      drive_stop();
      steer_center();
      state = 2;
    }
  }
}
```