user: 请将以下的汇编代码转换成C语言代码:

```asm
<seek_forward>:
  endbr64
  mov    $0x7,%eax
  cmpl   $0xff,(%rdi,%rdx,4)
  jg     L311
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdx,%r8
  cmp    $0x7,%ecx
  ja     L279
  mov    %ecx,%ecx
  lea    D0(%rip),%rdx
  movslq (%rdx,%rcx,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0xa,%ebx
  mov    $0xa,%ebp
  mov    $0xa,%r12d
  mov    $0xa,%r13d
  mov    $0xa,%r14d
  mov    $0x0,%r15d
  jmp    L2
  mov    $0x5,%ebx
  mov    $0x0,%ebp
  mov    $0x5,%r12d
  mov    $0x7,%r13d
  mov    $0x7,%r14d
  mov    $0x5,%r15d
  jmp    L2
  mov    $0x5,%ebx
  mov    $0x5,%ebp
  mov    $0x0,%r12d
  mov    $0x7,%r13d
  mov    $0x7,%r14d
  mov    $0x5,%r15d
  jmp    L2
  mov    $0xa,%ebx
  mov    $0xa,%ebp
  mov    $0xa,%r12d
  mov    $0x0,%r13d
  mov    $0xa,%r14d
  mov    $0xa,%r15d
  jmp    L2
  mov    $0x4,%ebx
  mov    $0x4,%ebp
  mov    $0x4,%r12d
  mov    $0x4,%r13d
  mov    $0x0,%r14d
  mov    $0x4,%r15d
  jmp    L2
L279:
  mov    $0x4,%ebx
  mov    $0x4,%ebp
  mov    $0x4,%r12d
  mov    $0x4,%r13d
  mov    $0x4,%r14d
  mov    $0x4,%r15d
  jmp    L2
  mov    $0x0,%ebx
  mov    $0xd,%ebp
  mov    $0xd,%r12d
  mov    $0xd,%r13d
  mov    $0xd,%r14d
  mov    $0xd,%r15d
L2:
  cmp    %rsi,%r8
  jae    L299
  lea    0x8(%r8),%r11
  cmp    $0xfffffffffffffff8,%r8
  jae    L299
  mov    %r8,%rdx
  mov    $0x1,%r10d
  jmp    L323
L202:
  mov    %eax,%ecx
  lea    -0x61(%rax),%r9d
  cmp    $0x19,%r9d
  ja     L355
  add    $0x8,%r14d
  add    $0x6,%r13d
  add    $0xa,%r12d
  add    $0x5,%ebp
  add    $0xd,%ebx
  mov    %r10d,%r9d
L54:
  cmp    $0x20,%eax
  je     L327
  test   %r9d,%r9d
  jne    L111
  add    $0x8,%r14d
  add    $0x10,%r13d
  add    $0xd,%r12d
  add    $0xd,%ebp
  add    $0xd,%ebx
L111:
  cmp    $0x7e,%eax
  jle    L318
  add    $0x14,%r13d
  add    $0x14,%r12d
  add    $0x14,%ebp
L318:
  add    $0x1,%rdx
  cmp    %rdx,%rsi
  jbe    L299
  cmp    %r11,%rdx
  ja     L299
L323:
  mov    (%rdi,%rdx,4),%eax
  cmp    $0xfe,%eax
  jle    L202
  add    $0x11,%r14d
  add    $0x17,%r13d
  add    $0x12,%r12d
  add    $0x12,%ebp
  add    $0xd,%ebx
  mov    %eax,%ecx
  mov    %r10d,%r9d
L306:
  sub    $0x30,%ecx
  cmp    $0x9,%ecx
  ja     L54
  add    $0x8,%r14d
  add    $0x6,%r13d
  add    $0x8,%r12d
  add    $0x8,%ebp
  add    $0xd,%ebx
  jmp    L111
L355:
  lea    -0x41(%rax),%r9d
  cmp    $0x19,%r9d
  ja     L194
  add    $0x8,%r14d
  add    $0x6,%r13d
  add    $0x5,%r12d
  add    $0xa,%ebp
  add    $0xd,%ebx
  cmp    $0x20,%eax
  jne    L111
L327:
  add    $0x8,%r14d
  add    $0x6,%r13d
  add    $0x5,%r12d
  add    $0x5,%ebp
  add    $0xd,%ebx
  jmp    L318
L194:
  mov    $0x0,%r9d
  jmp    L306
L299:
  lea    -0x1(%rsi),%rcx
  cmp    %rcx,%r8
  jae    L219
  lea    0x7(%r8),%r9
  mov    %r8,%rax
  cmp    $0xfffffffffffffff9,%r8
  jb     L406
L219:
  mov    %r8,%rdx
  call   <number_lat@plt>
  add    %eax,%r15d
  mov    $0x7,%eax
  cmp    %ebx,%r14d
  jg     L278
  mov    %r14d,%ebx
  mov    $0x6,%eax
L278:
  cmp    %r13d,%ebx
  jl     L195
  mov    %r13d,%ebx
  mov    $0x4,%eax
L195:
  cmp    %r12d,%ebx
  jl     L207
  mov    %r12d,%ebx
  mov    $0x3,%eax
L207:
  cmp    %ebp,%ebx
  jl     L166
  mov    %ebp,%ebx
  mov    $0x2,%eax
L166:
  cmp    %r15d,%ebx
  mov    $0x1,%edx
  cmovge %edx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L34:
  add    $0x1,%rax
  cmp    %rcx,%rax
  jae    L112
  cmp    %r9,%rax
  ja     L272
L406:
  cmpl   $0x13,(%rdi,%rax,4)
  jne    L34
  cmpl   $0x10,0x4(%rdi,%rax,4)
  jne    L34
  sub    $0xd,%ebx
  jmp    L34
L272:
  mov    %r8,%rax
  mov    $0xffffffff,%r10d
  jmp    L254
L112:
  mov    %r8,%rax
  mov    $0xffffffff,%r10d
  jmp    L254
L160:
  add    $0x1,%rax
  cmp    %rcx,%rax
  jae    L219
  cmp    %r9,%rax
  ja     L219
L254:
  movslq %r10d,%rdx
  cmp    %rax,%rdx
  je     L160
  mov    (%rdi,%rax,4),%edx
  sub    $0x30,%edx
  cmp    $0x9,%edx
  ja     L160
  mov    0x4(%rdi,%rax,4),%edx
  sub    $0x30,%edx
  cmp    $0x9,%edx
  ja     L160
  sub    $0xd,%ebx
  lea    0x1(%rax),%r10d
  jmp    L160
L311:
  ret
```

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, done;
  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++) {
    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;
}
```