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

```asm
<define_mode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %ecx,0x1c(%rsp)
  test   %edx,%edx
  jle    L300
  mov    %rdi,%r14
  mov    %edx,%r13d
  mov    %rsi,%rbx
  mov    %rdi,%rbp
  lea    -0x1(%rdx),%eax
  lea    0x4(%rsi,%rax,4),%r15
  mov    %rdi,%r12
  jmp    L146
L17:
  mov    %r12,0x10(%rsp)
  movb   $0x42,(%r12)
  mov    (%rbx),%edi
  call   <in_alpha@plt>
  test   %rax,%rax
  je     L260
  movb   $0x41,(%r12)
L260:
  cmpl   $0x0,0x1c(%rsp)
  je     L62
  mov    0x8(%rsp),%rax
  cmpl   $0x5b,(%rax)
  je     L311
L62:
  mov    0x8(%rsp),%rax
  mov    (%rax),%eax
  sub    $0x30,%eax
  cmp    $0x9,%eax
  ja     L306
  mov    0x10(%rsp),%rax
  movb   $0x4e,(%rax)
L306:
  add    $0x4,%rbx
  add    $0x1,%r12
  cmp    %r15,%rbx
  je     L156
L146:
  mov    %rbx,0x8(%rsp)
  cmpl   $0xff,(%rbx)
  jle    L17
  movb   $0x4b,(%r12)
  jmp    L306
L311:
  mov    0x10(%rsp),%rax
  movb   $0x41,(%rax)
  jmp    L62
L156:
  mov    %r13d,%edi
  mov    %r14,%rdx
  mov    $0x0,%ecx
  jmp    L279
L203:
  mov    %rcx,%rax
  mov    $0x0,%esi
L168:
  cmpb   $0x4e,(%r14,%rax,1)
  jne    L135
  add    $0x1,%esi
  add    $0x1,%rax
  cmp    %eax,%r13d
  jg     L168
L135:
  sub    $0x1,%esi
  cmp    $0x4,%esi
  ja     L153
  mov    %esi,%esi
  lea    0x1(%rdx,%rsi,1),%rsi
  mov    %rdx,%rax
L221:
  movb   $0x41,(%rax)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L221
L153:
  add    $0x1,%rcx
  add    $0x1,%rdx
  cmp    %rdi,%rcx
  je     L60
L279:
  cmpb   $0x4e,(%rdx)
  jne    L153
  test   %ecx,%ecx
  je     L203
  cmpb   $0x4e,-0x1(%rdx)
  je     L153
  mov    %rcx,%rax
  mov    $0x0,%esi
  cmp    %ecx,%r13d
  jg     L168
  jmp    L153
L60:
  mov    $0x0,%edx
  jmp    L250
L85:
  mov    %rdx,%rax
  mov    $0x0,%ecx
L44:
  cmpb   $0x41,(%r14,%rax,1)
  jne    L254
  add    $0x1,%ecx
  add    $0x1,%rax
  cmp    %eax,%r13d
  jg     L44
L254:
  sub    $0x1,%ecx
  cmp    $0x4,%ecx
  ja     L126
  mov    %ecx,%ecx
  lea    0x1(%rbp,%rcx,1),%rcx
  mov    %rbp,%rax
L297:
  movb   $0x42,(%rax)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L297
L126:
  add    $0x1,%rdx
  add    $0x1,%rbp
  cmp    %rdi,%rdx
  je     L300
L250:
  cmpb   $0x41,0x0(%rbp)
  jne    L126
  test   %edx,%edx
  je     L85
  cmpb   $0x41,-0x1(%rbp)
  je     L126
  mov    %rdx,%rax
  mov    $0x0,%ecx
  cmp    %edx,%r13d
  jg     L44
  jmp    L126
L300:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void define_mode(char mode[], int jisdata[], int length, int gs1) {
  int i, mlen, j;
  for (i = 0; i < length; i++) {
    if (jisdata[i] > 0xff) {
      mode[i] = 'K';
    } else {
      mode[i] = 'B';
      if (in_alpha(jisdata[i])) {
        mode[i] = 'A';
      }
      if (gs1 && (jisdata[i] == '[')) {
        mode[i] = 'A';
      }
      if ((jisdata[i] >= '0') && (jisdata[i] <= '9')) {
        mode[i] = 'N';
      }
    }
  }
  for (i = 0; i < length; i++) {
    if (mode[i] == 'N') {
      if (((i != 0) && (mode[i - 1] != 'N')) || (i == 0)) {
        mlen = 0;
        while (((mlen + i) < length) && (mode[mlen + i] == 'N')) {
          mlen++;
        };
        if (mlen < 6) {
          for (j = 0; j < mlen; j++) {
            mode[i + j] = 'A';
          }
        }
      }
    }
  }
  for (i = 0; i < length; i++) {
    if (mode[i] == 'A') {
      if (((i != 0) && (mode[i - 1] != 'A')) || (i == 0)) {
        mlen = 0;
        while (((mlen + i) < length) && (mode[mlen + i] == 'A')) {
          mlen++;
        };
        if (mlen < 6) {
          for (j = 0; j < mlen; j++) {
            mode[i + j] = 'B';
          }
        }
      }
    }
  }
}
```