user: Please show me the C implementation that matches the assembly code listed below:

```asm
<micro_qr_intermediate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xa0,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %ecx,-0x7c(%rbp)
  mov    %r8,-0x88(%rbp)
  mov    %r9,-0x90(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x98(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x54(%rbp)
  movl   $0x0,-0x34(%rbp)
  mov    -0x68(%rbp),%rax
  lea    D66(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L280
  movl   $0x0,-0x4c(%rbp)
  jmp    L408
L417:
  mov    -0x4c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
  addl   $0x1,-0x4c(%rbp)
L408:
  mov    -0x4c(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L417
  mov    $0xa,%edi
  call   <putchar@plt>
L280:
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L205
  mov    $0x5,%eax
  jmp    L569
L205:
  mov    -0x54(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x55(%rbp)
  movl   $0x0,-0x50(%rbp)
L242:
  addl   $0x1,-0x50(%rbp)
  mov    -0x50(%rbp),%edx
  mov    -0x54(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x7c(%rbp)
  jle    L252
  mov    -0x54(%rbp),%edx
  mov    -0x50(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    %al,-0x55(%rbp)
  je     L242
L252:
  movsbl -0x55(%rbp),%eax
  cmp    $0x4e,%eax
  je     L259
  cmp    $0x4e,%eax
  jg     L44
  cmp    $0x4b,%eax
  je     L397
  cmp    $0x4b,%eax
  jg     L44
  cmp    $0x41,%eax
  je     L512
  cmp    $0x42,%eax
  je     L538
  jmp    L44
L397:
  mov    -0x68(%rbp),%rax
  lea    D23(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x88(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x50(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L510
  mov    -0x50(%rbp),%eax
  mov    %eax,%esi
  lea    D89(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L510:
  movl   $0x0,-0x4c(%rbp)
  jmp    L194
L10:
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x48(%rbp)
  cmpl   $0x9fff,-0x48(%rbp)
  jle    L208
  subl   $0xc140,-0x48(%rbp)
L208:
  mov    -0x48(%rbp),%eax
  sar    $0x4,%eax
  and    $0xff0,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x48(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x24(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%ecx
  mov    -0x68(%rbp),%rax
  mov    $0x1000,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <qr_diran@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L282
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L282:
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L221
  mov    $0x5,%eax
  jmp    L569
L221:
  addl   $0x1,-0x4c(%rbp)
L194:
  mov    -0x4c(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L10
  cmpl   $0x0,-0x34(%rbp)
  je     L337
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L337
L538:
  mov    -0x68(%rbp),%rax
  lea    D143(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x98(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x50(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L572
  mov    -0x50(%rbp),%eax
  mov    %eax,%esi
  lea    D90(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L572:
  movl   $0x0,-0x4c(%rbp)
  jmp    L73
L434:
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%ecx
  mov    -0x68(%rbp),%rax
  mov    $0x80,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <qr_diran@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L257
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L257:
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L545
  mov    $0x5,%eax
  jmp    L569
L545:
  addl   $0x1,-0x4c(%rbp)
L73:
  mov    -0x4c(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L434
  cmpl   $0x0,-0x34(%rbp)
  je     L30
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L30
L512:
  mov    -0x68(%rbp),%rax
  lea    D132(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x90(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x50(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L21
  mov    -0x50(%rbp),%eax
  mov    %eax,%esi
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L21:
  movl   $0x0,-0x4c(%rbp)
  jmp    L240
L370:
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x14(%rbp)
  movl   $0x1,-0x44(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x40(%rbp)
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x50(%rbp)
  jle    L213
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x41,%al
  jne    L213
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x10(%rbp)
  movl   $0x2,-0x44(%rbp)
  mov    -0x14(%rbp),%eax
  imul   $0x2d,%eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x40(%rbp)
L213:
  mov    -0x44(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    -0x40(%rbp),%ecx
  mov    -0x68(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <qr_diran@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L249
  mov    -0x40(%rbp),%eax
  mov    %eax,%esi
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L249:
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L537
  mov    $0x5,%eax
  jmp    L569
L537:
  addl   $0x2,-0x4c(%rbp)
L240:
  mov    -0x4c(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L370
  cmpl   $0x0,-0x34(%rbp)
  je     L554
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L554
L259:
  mov    -0x68(%rbp),%rax
  lea    D108(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x50(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L516
  mov    -0x50(%rbp),%eax
  mov    %eax,%esi
  lea    D136(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L516:
  movl   $0x0,-0x4c(%rbp)
  jmp    L36
L328:
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x30(%rbp)
  movl   $0x1,-0x3c(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x4c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x50(%rbp)
  jle    L244
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x4e,%al
  jne    L244
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x2c(%rbp)
  movl   $0x2,-0x3c(%rbp)
  mov    -0x38(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
L244:
  mov    -0x4c(%rbp),%eax
  add    $0x2,%eax
  cmp    %eax,-0x50(%rbp)
  jle    L199
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x4e,%al
  jne    L199
  mov    -0x54(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x28(%rbp)
  movl   $0x3,-0x3c(%rbp)
  mov    -0x38(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
L199:
  mov    -0x3c(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    -0x38(%rbp),%ecx
  mov    -0x68(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <qr_diran@plt>
  cmpl   $0x0,-0x34(%rbp)
  je     L362
  mov    -0x38(%rbp),%edx
  mov    -0x38(%rbp),%eax
  mov    %eax,%esi
  lea    D142(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L362:
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L390
  mov    $0x5,%eax
  jmp    L569
L390:
  addl   $0x3,-0x4c(%rbp)
L36:
  mov    -0x4c(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L328
  cmpl   $0x0,-0x34(%rbp)
  je     L287
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L287
L337:
  nop
  jmp    L44
L30:
  nop
  jmp    L44
L554:
  nop
  jmp    L44
L287:
  nop
L44:
  mov    -0x50(%rbp),%eax
  add    %eax,-0x54(%rbp)
  mov    -0x7c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x54(%rbp)
  jl     L280
  mov    $0x0,%eax
L569:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L243
  call   <__stack_chk_fail@plt>
L243:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D66
type: string
name: extract_symbolic_data
arguments: tag: D23
type: string
name: extract_symbolic_data
arguments: tag: D89
type: string
name: extract_symbolic_data
arguments: tag: D37
type: string
name: extract_symbolic_data
arguments: tag: D143
type: string
name: extract_symbolic_data
arguments: tag: D90
type: string
name: extract_symbolic_data
arguments: tag: D132
type: string
name: extract_symbolic_data
arguments: tag: D61
type: string
name: extract_symbolic_data
arguments: tag: D9
type: string
name: extract_symbolic_data
arguments: tag: D108
type: string
name: extract_symbolic_data
arguments: tag: D136
type: string
name: extract_symbolic_data
arguments: tag: D115
type: string
name: extract_symbolic_data
arguments: tag: D142
type: string

tool: 

tool: D23: K

tool: D89: Kanji block (length %d)
	

tool: D37: 0x%4X 

tool: D143: B

tool: D90: Byte block (length %d)
	

tool: D132: A

tool: D61: Alpha block (length %d)
	

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

tool: D108: N

tool: D136: Number block (length %d)
	

tool: D115: 0123456789

tool: D142: 0x%4X (%d)

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