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

```asm
<seek_forward>:
  endbr64
  mov    (%rdi,%rdx,4),%r9d
  cmp    $0xff,%r9d
  jg     L52
  push   %r15
  lea    -0x1(%rcx),%eax
  mov    %rdx,%r8
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x6,%eax
  ja     L257
  lea    D55(%rip),%rdx
  mov    (%rdx,%rax,4),%r15d
  lea    D51(%rip),%rdx
  mov    (%rdx,%rax,4),%r13d
  lea    D6(%rip),%rdx
  mov    (%rdx,%rax,4),%r12d
  lea    D49(%rip),%rdx
  mov    (%rdx,%rax,4),%ebp
  lea    D41(%rip),%rdx
  mov    (%rdx,%rax,4),%ebx
  lea    D52(%rip),%rdx
  mov    (%rdx,%rax,4),%r14d
L91:
  cmp    %rsi,%r8
  jae    L336
  mov    %r8,%r10
  add    $0x8,%r10
  jb     L336
  mov    %r9d,%edx
  mov    %r8,%rax
  jmp    L167
L135:
  add    $0x11,%r15d
  add    $0x17,%r13d
  add    $0x12,%r12d
  add    $0x12,%ebp
  add    $0xd,%ebx
  mov    $0x1,%r11d
L1:
  lea    -0x41(%rdx),%ecx
  cmp    $0x19,%ecx
  ja     L107
  add    $0x8,%r15d
  add    $0x6,%r13d
  add    $0x5,%r12d
  add    $0xa,%ebp
  add    $0xd,%ebx
L200:
  add    $0x1,%rax
  cmp    %rax,%rsi
  jbe    L336
L165:
  cmp    %rax,%r10
  jb     L336
  mov    (%rdi,%rax,4),%edx
L167:
  cmp    $0xfe,%edx
  jg     L135
  lea    -0x61(%rdx),%ecx
  cmp    $0x19,%ecx
  ja     L65
  add    $0x8,%r15d
  add    $0x6,%r13d
  add    $0xa,%r12d
  add    $0x5,%ebp
  add    $0xd,%ebx
L186:
  cmp    $0x7e,%edx
  jle    L200
  add    $0x1,%rax
  add    $0x14,%r13d
  add    $0x14,%r12d
  add    $0x14,%ebp
  cmp    %rax,%rsi
  ja     L165
L336:
  lea    -0x1(%rsi),%rcx
  cmp    %rcx,%r8
  jae    L184
  mov    %r8,%r10
  add    $0x7,%r10
  jb     L184
  mov    %r8,%rax
  jmp    L31
  nopl   (%rax)
L110:
  cmp    %rcx,%rax
  jae    L3
L295:
  cmp    %rax,%r10
  jb     L3
  mov    (%rdi,%rax,4),%r9d
L31:
  add    $0x1,%rax
  cmp    $0x13,%r9d
  jne    L110
  cmpl   $0x10,(%rdi,%rax,4)
  jne    L110
  sub    $0xd,%ebx
  cmp    %rcx,%rax
  jb     L295
  xchg   %ax,%ax
L3:
  mov    %r8,%rax
  mov    $0xffffffff,%r9d
  jmp    L8
  nopl   0x0(%rax,%rax,1)
L208:
  cmp    %rax,%r10
  jb     L184
L8:
  mov    %rax,%rdx
  movslq %r9d,%r11
  add    $0x1,%rax
  cmp    %rdx,%r11
  je     L371
  mov    -0x4(%rdi,%rax,4),%edx
  sub    $0x30,%edx
  cmp    $0x9,%edx
  ja     L371
  mov    (%rdi,%rax,4),%edx
  sub    $0x30,%edx
  cmp    $0x9,%edx
  ja     L371
  sub    $0xd,%ebx
  mov    %eax,%r9d
  nopl   0x0(%rax)
L371:
  cmp    %rcx,%rax
  jb     L208
L184:
  mov    %r8,%rdx
  call   <number_lat@plt>
  add    %eax,%r14d
  mov    $0x7,%eax
  cmp    %ebx,%r15d
  jg     L117
  mov    %r15d,%ebx
  mov    $0x6,%eax
L117:
  cmp    %r13d,%ebx
  jl     L316
  mov    %r13d,%ebx
  mov    $0x4,%eax
L316:
  cmp    %r12d,%ebx
  jl     L252
  mov    %r12d,%ebx
  mov    $0x3,%eax
L252:
  cmp    %ebp,%ebx
  jl     L367
  mov    %ebp,%ebx
  mov    $0x2,%eax
L367:
  cmp    %r14d,%ebx
  mov    $0x1,%edx
  cmovge %edx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L257:
  mov    $0x4,%r14d
  mov    $0x4,%ebx
  mov    $0x4,%ebp
  mov    $0x4,%r12d
  mov    $0x4,%r13d
  mov    $0x4,%r15d
  jmp    L91
  nopw   0x0(%rax,%rax,1)
L107:
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%ecx
  ja     L205
  add    $0x8,%r15d
  add    $0x6,%r13d
  add    $0x8,%r12d
  add    $0x8,%ebp
  add    $0xd,%ebx
  jmp    L200
  nop
L205:
  cmp    $0x20,%edx
  jne    L82
  add    $0x8,%r15d
  add    $0x6,%r13d
  add    $0x5,%r12d
  add    $0x5,%ebp
  add    $0xd,%ebx
  jmp    L200
  nopl   0x0(%rax)
L52:
  mov    $0x7,%eax
  ret
L65:
  xor    %r11d,%r11d
  jmp    L1
L82:
  test   %r11d,%r11d
  jne    L186
  add    $0x8,%r15d
  add    $0x10,%r13d
  add    $0xd,%r12d
  add    $0xd,%ebp
  add    $0xd,%ebx
  jmp    L186
```

tool_calls: name: unpack_data
arguments: data_tag: D55
type: string
name: unpack_data
arguments: data_tag: D51
type: string
name: unpack_data
arguments: data_tag: D6
type: string
name: unpack_data
arguments: data_tag: D49
type: string
name: unpack_data
arguments: data_tag: D41
type: string
name: unpack_data
arguments: data_tag: D52
type: string

tool: D55: 


tool: D51: 


tool: D6: 


tool: D49: 


tool: D41: 


tool: 

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;
}
```