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

```asm
<seek_forward>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %ecx,-0x5c(%rbp)
  movl   $0xffffffff,-0x14(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    -0x58(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xff,%eax
  jle    L157
  mov    $0x7,%eax
  jmp    L199
L157:
  cmpl   $0x7,-0x5c(%rbp)
  ja     L303
  mov    -0x5c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D10(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D10(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  movl   $0xd,-0x34(%rbp)
  movl   $0xd,-0x30(%rbp)
  movl   $0xd,-0x2c(%rbp)
  movl   $0xd,-0x28(%rbp)
  movl   $0xd,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L179
  movl   $0x0,-0x34(%rbp)
  movl   $0xa,-0x30(%rbp)
  movl   $0xa,-0x2c(%rbp)
  movl   $0xa,-0x28(%rbp)
  movl   $0xa,-0x24(%rbp)
  movl   $0xa,-0x20(%rbp)
  jmp    L179
  movl   $0x5,-0x34(%rbp)
  movl   $0x7,-0x30(%rbp)
  movl   $0x7,-0x2c(%rbp)
  movl   $0x5,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x5,-0x20(%rbp)
  jmp    L179
  movl   $0x5,-0x34(%rbp)
  movl   $0x7,-0x30(%rbp)
  movl   $0x7,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  movl   $0x5,-0x24(%rbp)
  movl   $0x5,-0x20(%rbp)
  jmp    L179
  movl   $0xa,-0x34(%rbp)
  movl   $0xa,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0xa,-0x28(%rbp)
  movl   $0xa,-0x24(%rbp)
  movl   $0xa,-0x20(%rbp)
  jmp    L179
  movl   $0x4,-0x34(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x4,-0x2c(%rbp)
  movl   $0x4,-0x28(%rbp)
  movl   $0x4,-0x24(%rbp)
  movl   $0x4,-0x20(%rbp)
  jmp    L179
L303:
  movl   $0x4,-0x34(%rbp)
  movl   $0x4,-0x30(%rbp)
  movl   $0x4,-0x2c(%rbp)
  movl   $0x4,-0x28(%rbp)
  movl   $0x4,-0x24(%rbp)
  movl   $0x4,-0x20(%rbp)
L179:
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L242
L132:
  movl   $0x0,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0xfe,%eax
  jle    L232
  addl   $0x11,-0x30(%rbp)
  addl   $0x17,-0x2c(%rbp)
  addl   $0x12,-0x28(%rbp)
  addl   $0x12,-0x24(%rbp)
  addl   $0xd,-0x20(%rbp)
  movl   $0x1,-0x10(%rbp)
L232:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x60,%eax
  jle    L128
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x7a,%eax
  jg     L128
  addl   $0x8,-0x30(%rbp)
  addl   $0x6,-0x2c(%rbp)
  addl   $0xa,-0x28(%rbp)
  addl   $0x5,-0x24(%rbp)
  addl   $0xd,-0x20(%rbp)
  movl   $0x1,-0x10(%rbp)
L128:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x40,%eax
  jle    L39
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x5a,%eax
  jg     L39
  addl   $0x8,-0x30(%rbp)
  addl   $0x6,-0x2c(%rbp)
  addl   $0x5,-0x28(%rbp)
  addl   $0xa,-0x24(%rbp)
  addl   $0xd,-0x20(%rbp)
  movl   $0x1,-0x10(%rbp)
L39:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x2f,%eax
  jle    L351
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x39,%eax
  jg     L351
  addl   $0x8,-0x30(%rbp)
  addl   $0x6,-0x2c(%rbp)
  addl   $0x8,-0x28(%rbp)
  addl   $0x8,-0x24(%rbp)
  addl   $0xd,-0x20(%rbp)
  movl   $0x1,-0x10(%rbp)
L351:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x20,%eax
  jne    L259
  addl   $0x8,-0x30(%rbp)
  addl   $0x6,-0x2c(%rbp)
  addl   $0x5,-0x28(%rbp)
  addl   $0x5,-0x24(%rbp)
  addl   $0xd,-0x20(%rbp)
  movl   $0x1,-0x10(%rbp)
L259:
  cmpl   $0x0,-0x10(%rbp)
  jne    L333
  addl   $0x8,-0x30(%rbp)
  addl   $0x10,-0x2c(%rbp)
  addl   $0xd,-0x28(%rbp)
  addl   $0xd,-0x24(%rbp)
  addl   $0xd,-0x20(%rbp)
L333:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x7e,%eax
  jle    L17
  addl   $0x14,-0x2c(%rbp)
  addl   $0x14,-0x28(%rbp)
  addl   $0x14,-0x24(%rbp)
L17:
  addq   $0x1,-0x8(%rbp)
L242:
  mov    -0x8(%rbp),%rax
  cmp    -0x50(%rbp),%rax
  jae    L356
  mov    -0x58(%rbp),%rax
  add    $0x8,%rax
  cmp    %rax,-0x8(%rbp)
  jbe    L132
L356:
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L178
L172:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x13,%eax
  jne    L257
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x10,%eax
  jne    L257
  subl   $0xd,-0x20(%rbp)
L257:
  addq   $0x1,-0x8(%rbp)
L178:
  mov    -0x50(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x8(%rbp)
  jae    L386
  mov    -0x58(%rbp),%rax
  add    $0x7,%rax
  cmp    %rax,-0x8(%rbp)
  jbe    L172
L386:
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L345
L240:
  mov    -0x14(%rbp),%eax
  cltq
  cmp    %rax,-0x8(%rbp)
  je     L21
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x2f,%eax
  jle    L21
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x39,%eax
  jg     L21
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x2f,%eax
  jle    L21
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x39,%eax
  jg     L21
  subl   $0xd,-0x20(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
L21:
  addq   $0x1,-0x8(%rbp)
L345:
  mov    -0x50(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x8(%rbp)
  jae    L378
  mov    -0x58(%rbp),%rax
  add    $0x7,%rax
  cmp    %rax,-0x8(%rbp)
  jbe    L240
L378:
  mov    -0x58(%rbp),%rdx
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <number_lat@plt>
  mov    %eax,%edx
  mov    -0x34(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L311
  mov    -0x24(%rbp),%r8d
  mov    -0x28(%rbp),%edi
  mov    -0x2c(%rbp),%ecx
  mov    -0x30(%rbp),%edx
  mov    -0x20(%rbp),%eax
  sub    $0x8,%rsp
  mov    -0x34(%rbp),%esi
  push   %rsi
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %eax,%esi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  add    $0x10,%rsp
L311:
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x7,-0x1c(%rbp)
  mov    -0x30(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jg     L314
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x6,-0x1c(%rbp)
L314:
  mov    -0x2c(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jg     L130
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x4,-0x1c(%rbp)
L130:
  mov    -0x28(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jg     L113
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x3,-0x1c(%rbp)
L113:
  mov    -0x24(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jg     L252
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x2,-0x1c(%rbp)
L252:
  mov    -0x34(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jg     L231
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x1,-0x1c(%rbp)
L231:
  mov    -0x1c(%rbp),%eax
L199:
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D29
data_type: string

tool: D29: C %d / B %d / M %d / U %d / L %d / N %d


assistant: ```c
int seek_forward(int gbdata[], const size_t length, const size_t position, int current_mode) {
  int number_count, byte_count, mixed_count, upper_count, lower_count, chinese_count;
  int best_mode;
  size_t sp;
  int best_count, last = -1;
  int debug = 0;
  if (gbdata[position] > 0xff) {
    return 7;
  }
  switch (current_mode) {
  case 7:
    number_count = 13;
    byte_count = 13;
    mixed_count = 13;
    upper_count = 13;
    lower_count = 13;
    chinese_count = 0;
    break;
  case 1:
    number_count = 0;
    byte_count = 10;
    mixed_count = 10;
    upper_count = 10;
    lower_count = 10;
    chinese_count = 10;
    break;
  case 2:
    number_count = 5;
    byte_count = 7;
    mixed_count = 7;
    upper_count = 5;
    lower_count = 0;
    chinese_count = 5;
    break;
  case 3:
    number_count = 5;
    byte_count = 7;
    mixed_count = 7;
    upper_count = 0;
    lower_count = 5;
    chinese_count = 5;
    break;
  case 4:
    number_count = 10;
    byte_count = 10;
    mixed_count = 0;
    upper_count = 10;
    lower_count = 10;
    chinese_count = 10;
    break;
  case 6:
    number_count = 4;
    byte_count = 0;
    mixed_count = 4;
    upper_count = 4;
    lower_count = 4;
    chinese_count = 4;
    break;
  default:
    number_count = 4;
    byte_count = 4;
    mixed_count = 4;
    upper_count = 4;
    lower_count = 4;
    chinese_count = 4;
  }
  for (sp = position; (sp < length) && (sp <= (position + 8)); sp++) {
    int done = 0;
    if (gbdata[sp] >= 0xff) {
      byte_count += 17;
      mixed_count += 23;
      upper_count += 18;
      lower_count += 18;
      chinese_count += 13;
      done = 1;
    }
    if ((gbdata[sp] >= 'a') && (gbdata[sp] <= 'z')) {
      byte_count += 8;
      mixed_count += 6;
      upper_count += 10;
      lower_count += 5;
      chinese_count += 13;
      done = 1;
    }
    if ((gbdata[sp] >= 'A') && (gbdata[sp] <= 'Z')) {
      byte_count += 8;
      mixed_count += 6;
      upper_count += 5;
      lower_count += 10;
      chinese_count += 13;
      done = 1;
    }
    if ((gbdata[sp] >= '0') && (gbdata[sp] <= '9')) {
      byte_count += 8;
      mixed_count += 6;
      upper_count += 8;
      lower_count += 8;
      chinese_count += 13;
      done = 1;
    }
    if (gbdata[sp] == ' ') {
      byte_count += 8;
      mixed_count += 6;
      upper_count += 5;
      lower_count += 5;
      chinese_count += 13;
      done = 1;
    }
    if (done == 0) {
      byte_count += 8;
      mixed_count += 16;
      upper_count += 13;
      lower_count += 13;
      chinese_count += 13;
    }
    if (gbdata[sp] >= 0x7f) {
      mixed_count += 20;
      upper_count += 20;
      lower_count += 20;
    }
  }
  for (sp = position; (sp < (length - 1)) && (sp <= (position + 7)); sp++) {
    if ((gbdata[sp] == 0x13) && (gbdata[sp + 1] == 0x10)) {
      chinese_count -= 13;
    }
  }
  for (sp = position; (sp < (length - 1)) && (sp <= (position + 7)); sp++) {
    if (sp != last) {
      if (((gbdata[sp] >= '0') && (gbdata[sp] <= '9')) && ((gbdata[sp + 1] >= '0') && (gbdata[sp + 1] <= '9'))) {
        chinese_count -= 13;
        last = (int)(sp + 1);
      }
    }
  }
  number_count += number_lat(gbdata, length, position);
  if (debug) {
    printf("C %d / B %d / M %d / U %d / L %d / N %d\n", chinese_count, byte_count, mixed_count, upper_count, lower_count, number_count);
  }
  best_count = chinese_count;
  best_mode = 7;
  if (byte_count <= best_count) {
    best_count = byte_count;
    best_mode = 6;
  }
  if (mixed_count <= best_count) {
    best_count = mixed_count;
    best_mode = 4;
  }
  if (upper_count <= best_count) {
    best_count = upper_count;
    best_mode = 3;
  }
  if (lower_count <= best_count) {
    best_count = lower_count;
    best_mode = 2;
  }
  if (number_count <= best_count) {
    best_count = number_count;
    best_mode = 1;
  }
  return best_mode;
}
```