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

```asm
<micro_qr_intermediate>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x58,%rsp
  mov    0x90(%rsp),%rax
  mov    %rsi,0x18(%rsp)
  lea    D3(%rip),%rsi
  mov    %rdx,0x10(%rsp)
  mov    %ecx,0xc(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %r9,0x28(%rsp)
  mov    %rax,0x30(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <strcpy@plt>
L158:
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jg     L356
  mov    0x10(%rsp),%rcx
  movslq %r12d,%r14
  mov    0xc(%rsp),%esi
  xor    %r13d,%r13d
  lea    (%rcx,%r14,1),%rax
  lea    0x1(%rcx,%r14,1),%rdx
  mov    %rax,(%rsp)
  movzbl (%rax),%edi
  lea    0x1(%r12),%eax
  jmp    L319
  nopw   0x0(%rax,%rax,1)
L230:
  movzbl (%rdx),%ecx
  add    $0x1,%eax
  add    $0x1,%rdx
  cmp    %dil,%cl
  jne    L297
L319:
  movslq %r13d,%rbp
  mov    %eax,%r12d
  add    $0x1,%r13d
  cmp    %esi,%eax
  jl     L230
L297:
  cmp    $0x4b,%dil
  je     L132
  jg     L307
  cmp    $0x41,%dil
  je     L137
  cmp    $0x42,%dil
  jne    L365
  lea    D7(%rip),%rsi
  mov    %rbx,%rdi
  add    %r14,%rbp
  call   <strcat@plt>
  mov    0x30(%rsp),%rax
  lea    0x46(%rsp),%rsi
  mov    %rbx,%rdi
  mov    %r13b,0x46(%rsp)
  movl   $0x1,(%rax)
  movb   $0x0,0x47(%rsp)
  call   <strcat@plt>
  mov    0x18(%rsp),%rax
  lea    (%rax,%r14,4),%r15
  lea    0x4(%rax,%rbp,4),%rbp
  nopw   0x0(%rax,%rax,1)
L281:
  mov    (%r15),%esi
  mov    %rbx,%rdi
  mov    $0x80,%edx
  call   <qr_diran@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jg     L356
  add    $0x4,%r15
  cmp    %rbp,%r15
  jne    L281
L365:
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    %eax,%r12d
  jl     L158
L122:
  xor    %eax,%eax
  jmp    L102
  nopl   0x0(%rax,%rax,1)
L307:
  cmp    $0x4e,%dil
  jne    L365
  lea    D10(%rip),%rsi
  mov    %rbx,%rdi
  xor    %r15d,%r15d
  call   <strcat@plt>
  lea    0x46(%rsp),%rsi
  mov    %rbx,%rdi
  mov    %r13b,0x46(%rsp)
  movb   $0x0,0x47(%rsp)
  call   <strcat@plt>
  mov    0x18(%rsp),%rax
  mov    %r12d,0x38(%rsp)
  mov    %r15,%r12
  mov    %ebp,%r15d
  mov    (%rsp),%rbp
  lea    (%rax,%r14,4),%r14
  jmp    L355
  nopl   0x0(%rax)
L98:
  movsbl 0x8(%r14),%esi
  lea    D52(%rip),%rdi
  mov    %r8d,(%rsp)
  call   <posn@plt>
  mov    (%rsp),%r8d
  lea    (%r8,%r8,4),%edx
  lea    (%rax,%rdx,2),%r8d
  mov    $0x200,%edx
  xchg   %ax,%ax
L95:
  mov    %rbx,%rdi
  mov    %r8d,%esi
  call   <qr_diran@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jg     L356
  add    $0x3,%r12
  add    $0xc,%r14
  cmp    %r12d,%r13d
  jle    L25
L355:
  movsbl (%r14),%esi
  lea    D52(%rip),%rdi
  call   <posn@plt>
  mov    $0x8,%edx
  mov    %eax,%r8d
  cmp    %r12d,%r15d
  jle    L40
  cmpb   $0x4e,0x1(%rbp,%r12,1)
  je     L296
L40:
  lea    0x2(%r12),%eax
  cmp    %eax,%r13d
  jle    L95
  cmpb   $0x4e,0x2(%rbp,%r12,1)
  jne    L95
  jmp    L98
  nopl   0x0(%rax,%rax,1)
L356:
  mov    $0x5,%eax
L102:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L132:
  lea    D60(%rip),%rsi
  mov    %rbx,%rdi
  add    %r14,%rbp
  call   <strcat@plt>
  mov    0x20(%rsp),%rax
  lea    0x46(%rsp),%rsi
  mov    %rbx,%rdi
  mov    %r13b,0x46(%rsp)
  movl   $0x1,(%rax)
  movb   $0x0,0x47(%rsp)
  call   <strcat@plt>
  mov    0x18(%rsp),%rax
  lea    (%rax,%r14,4),%r15
  lea    0x4(%rax,%rbp,4),%rbp
  nopw   0x0(%rax,%rax,1)
L129:
  mov    (%r15),%eax
  mov    %rbx,%rdi
  cmp    $0x9fff,%eax
  lea    -0xc140(%rax),%edx
  cmovg  %edx,%eax
  mov    %eax,%edx
  movzbl %al,%eax
  sar    $0x4,%edx
  and    $0xff0,%edx
  lea    (%rdx,%rdx,2),%esi
  mov    $0x1000,%edx
  shl    $0x6,%esi
  add    %eax,%esi
  call   <qr_diran@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jg     L356
  add    $0x4,%r15
  cmp    %r15,%rbp
  jne    L129
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    %eax,%r12d
  jl     L158
  jmp    L122
  nopl   (%rax)
L137:
  lea    D41(%rip),%rsi
  mov    %rbx,%rdi
  xor    %r15d,%r15d
  call   <strcat@plt>
  mov    0x28(%rsp),%rax
  lea    0x46(%rsp),%rsi
  mov    %rbx,%rdi
  mov    %r13b,0x46(%rsp)
  movl   $0x1,(%rax)
  movb   $0x0,0x47(%rsp)
  call   <strcat@plt>
  mov    0x18(%rsp),%rax
  mov    %r12d,0x3c(%rsp)
  mov    %r15,%r12
  mov    %r13d,%r15d
  mov    %ebp,%r13d
  lea    (%rax,%r14,4),%rax
  lea    D25(%rip),%r14
  mov    %rax,%rbp
  jmp    L66
  nopw   0x0(%rax,%rax,1)
L110:
  mov    %rbx,%rdi
  mov    %r8d,%esi
  call   <qr_diran@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jg     L356
  add    $0x2,%r12
  cmp    %r12d,%r15d
  jle    L359
L66:
  movsbl 0x0(%rbp,%r12,4),%esi
  mov    %r14,%rdi
  call   <posn@plt>
  mov    $0x20,%edx
  mov    %eax,%r8d
  cmp    %r12d,%r13d
  jle    L110
  mov    (%rsp),%rax
  cmpb   $0x41,0x1(%rax,%r12,1)
  jne    L110
  movsbl 0x4(%rbp,%r12,4),%esi
  mov    %r14,%rdi
  mov    %r8d,0x38(%rsp)
  call   <posn@plt>
  mov    0x38(%rsp),%r8d
  mov    $0x400,%edx
  imul   $0x2d,%r8d,%r8d
  add    %eax,%r8d
  jmp    L110
  nopl   0x0(%rax,%rax,1)
L296:
  movsbl 0x4(%r14),%esi
  lea    D52(%rip),%rdi
  mov    %eax,(%rsp)
  call   <posn@plt>
  mov    (%rsp),%r8d
  lea    (%r8,%r8,4),%edx
  lea    (%rax,%rdx,2),%r8d
  mov    $0x40,%edx
  jmp    L40
  nopw   0x0(%rax,%rax,1)
L25:
  mov    0xc(%rsp),%eax
  mov    0x38(%rsp),%r12d
  sub    $0x1,%eax
  cmp    %eax,%r12d
  jl     L158
  jmp    L122
  nopw   0x0(%rax,%rax,1)
L359:
  mov    0xc(%rsp),%eax
  mov    0x3c(%rsp),%r12d
  sub    $0x1,%eax
  cmp    %eax,%r12d
  jl     L158
  jmp    L122
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D3
datatype: string
name: parse_data
arguments: data_label: D7
datatype: string
name: parse_data
arguments: data_label: D10
datatype: string
name: parse_data
arguments: data_label: D52
datatype: string
name: parse_data
arguments: data_label: D60
datatype: string
name: parse_data
arguments: data_label: D41
datatype: string
name: parse_data
arguments: data_label: D25
datatype: string

tool: 

tool: D7: B

tool: D10: N

tool: D52: 0123456789

tool: D60: K

tool: D41: A

tool: D25: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:

assistant: ```c
int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length, int *kanji_used, int *alphanum_used, int *byte_used) {
  int position = 0, debug = 0;
  int short_data_block_length, i;
  char data_block;
  char buffer[2];
  strcpy(binary, "");
  if (debug) {
    for (i = 0; i < length; i++) {
      printf("%c", mode[i]);
    }
    printf("\n");
  }
  do {
    if (strlen(binary) > 128) {
      return 5;
    }
    data_block = mode[position];
    short_data_block_length = 0;
    do {
      short_data_block_length++;
    } while (((short_data_block_length + position) < length) && (mode[position + short_data_block_length] == data_block));
    switch (data_block) {
    case 'K':
      strcat(binary, "K");
      *kanji_used = 1;
      buffer[0] = short_data_block_length;
      buffer[1] = '\0';
      strcat(binary, buffer);
      if (debug) {
        printf("Kanji block (length %d)\n\t", short_data_block_length);
      }
      for (i = 0; i < short_data_block_length; i++) {
        int jis = jisdata[position + i];
        int msb, lsb, prod;
        if (jis > 0x9fff) {
          jis -= 0xc140;
        }
        msb = (jis & 0xff00) >> 4;
        lsb = (jis & 0xff);
        prod = (msb * 0xc0) + lsb;
        qr_diran(binary, prod, 0x1000);
        if (debug) {
          printf("0x%4X ", prod);
        }
        if (strlen(binary) > 128) {
          return 5;
        }
      }
      if (debug) {
        printf("\n");
      }
      break;
    case 'B':
      strcat(binary, "B");
      *byte_used = 1;
      buffer[0] = short_data_block_length;
      buffer[1] = '\0';
      strcat(binary, buffer);
      if (debug) {
        printf("Byte block (length %d)\n\t", short_data_block_length);
      }
      for (i = 0; i < short_data_block_length; i++) {
        int byte = jisdata[position + i];
        qr_diran(binary, byte, 0x80);
        if (debug) {
          printf("0x%4X ", byte);
        }
        if (strlen(binary) > 128) {
          return 5;
        }
      }
      if (debug) {
        printf("\n");
      }
      break;
    case 'A':
      strcat(binary, "A");
      *alphanum_used = 1;
      buffer[0] = short_data_block_length;
      buffer[1] = '\0';
      strcat(binary, buffer);
      if (debug) {
        printf("Alpha block (length %d)\n\t", short_data_block_length);
      }
      i = 0;
      while (i < short_data_block_length) {
        int count;
        int first = 0, second = 0, prod;
        first = posn("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:", (char)jisdata[position + i]);
        count = 1;
        prod = first;
        if (i + 1 < short_data_block_length && mode[position + i + 1] == 'A') {
          second = posn("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:", (char)jisdata[position + i + 1]);
          count = 2;
          prod = (first * 45) + second;
        }
        qr_diran(binary, prod, 1 << (5 * count));
        if (debug) {
          printf("0x%4X ", prod);
        }
        if (strlen(binary) > 128) {
          return 5;
        }
        i += 2;
      };
      if (debug) {
        printf("\n");
      }
      break;
    case 'N':
      strcat(binary, "N");
      buffer[0] = short_data_block_length;
      buffer[1] = '\0';
      strcat(binary, buffer);
      if (debug) {
        printf("Number block (length %d)\n\t", short_data_block_length);
      }
      i = 0;
      while (i < short_data_block_length) {
        int count;
        int first = 0, second = 0, third = 0, prod;
        first = posn("0123456789", (char)jisdata[position + i]);
        count = 1;
        prod = first;
        if (i + 1 < short_data_block_length && mode[position + i + 1] == 'N') {
          second = posn("0123456789", (char)jisdata[position + i + 1]);
          count = 2;
          prod = (prod * 10) + second;
        }
        if (i + 2 < short_data_block_length && mode[position + i + 2] == 'N') {
          third = posn("0123456789", (char)jisdata[position + i + 2]);
          count = 3;
          prod = (prod * 10) + third;
        }
        qr_diran(binary, prod, 1 << (3 * count));
        if (debug) {
          printf("0x%4X (%d)", prod, prod);
        }
        if (strlen(binary) > 128) {
          return 5;
        }
        i += 3;
      };
      if (debug) {
        printf("\n");
      }
      break;
    }
    position += short_data_block_length;
  } while (position < length - 1);
  return 0;
}
```