user: 请从给定的汇编指令推导出C源代码:

```asm
<micro_qr_intermediate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %r8,-0x78(%rbp)
  mov    %r9,-0x80(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x88(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x48(%rbp)
  mov    -0x58(%rbp),%rax
  lea    D107(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L312
  movl   $0x0,-0x44(%rbp)
  jmp    L425
L395:
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
  addl   $0x1,-0x44(%rbp)
L425:
  mov    -0x44(%rbp),%eax
  cltq
  cmp    %rax,-0x70(%rbp)
  ja     L395
  mov    $0xa,%edi
  call   <putchar@plt>
L312:
  movl   $0x0,-0x40(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L405
  mov    $0x5,%eax
  jmp    L367
L405:
  mov    -0x48(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x49(%rbp)
L372:
  addl   $0x1,-0x40(%rbp)
  mov    -0x40(%rbp),%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  cltq
  cmp    %rax,-0x70(%rbp)
  jbe    L58
  mov    -0x48(%rbp),%edx
  mov    -0x40(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    %al,-0x49(%rbp)
  je     L372
L58:
  movsbl -0x49(%rbp),%eax
  cmp    $0x4e,%eax
  je     L325
  cmp    $0x4e,%eax
  jg     L160
  cmp    $0x4b,%eax
  je     L217
  cmp    $0x4b,%eax
  jg     L160
  cmp    $0x41,%eax
  je     L249
  cmp    $0x42,%eax
  je     L566
  jmp    L160
L217:
  mov    -0x58(%rbp),%rax
  lea    D162(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x78(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x40(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L439
  mov    -0x40(%rbp),%eax
  mov    %eax,%esi
  lea    D83(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L439:
  movl   $0x0,-0x44(%rbp)
  jmp    L144
L504:
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x3c(%rbp)
  cmpl   $0x813f,-0x3c(%rbp)
  jle    L185
  cmpl   $0x9ffc,-0x3c(%rbp)
  jg     L185
  subl   $0x8140,-0x3c(%rbp)
  jmp    L374
L185:
  cmpl   $0xe03f,-0x3c(%rbp)
  jle    L374
  cmpl   $0xebbf,-0x3c(%rbp)
  jg     L374
  subl   $0xc140,-0x3c(%rbp)
L374:
  mov    -0x3c(%rbp),%eax
  sar    $0x8,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x3c(%rbp),%eax
  movzbl %al,%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x58(%rbp),%rdx
  mov    -0x1c(%rbp),%eax
  mov    $0xd,%esi
  mov    %eax,%edi
  call   <bin_append@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L182
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L182:
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L46
  mov    $0x5,%eax
  jmp    L367
L46:
  addl   $0x1,-0x44(%rbp)
L144:
  mov    -0x44(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L504
  cmpl   $0x0,0x18(%rbp)
  je     L255
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L255
L566:
  mov    -0x58(%rbp),%rax
  lea    D43(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x88(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x40(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L556
  mov    -0x40(%rbp),%eax
  mov    %eax,%esi
  lea    D99(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L556:
  movl   $0x0,-0x44(%rbp)
  jmp    L420
L87:
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x58(%rbp),%rdx
  mov    -0x18(%rbp),%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <bin_append@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L509
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L509:
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L236
  mov    $0x5,%eax
  jmp    L367
L236:
  addl   $0x1,-0x44(%rbp)
L420:
  mov    -0x44(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L87
  cmpl   $0x0,0x18(%rbp)
  je     L544
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L544
L249:
  mov    -0x58(%rbp),%rax
  lea    D111(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x80(%rbp),%rax
  movl   $0x1,(%rax)
  mov    -0x40(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L11
  mov    -0x40(%rbp),%eax
  mov    %eax,%esi
  lea    D113(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L11:
  movl   $0x0,-0x44(%rbp)
  jmp    L397
L17:
  movl   $0x0,-0x14(%rbp)
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D94(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x14(%rbp)
  movl   $0x1,-0x38(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x44(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x40(%rbp)
  jle    L531
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x41,%al
  jne    L531
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D94(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x10(%rbp)
  movl   $0x2,-0x38(%rbp)
  mov    -0x14(%rbp),%eax
  imul   $0x2d,%eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x34(%rbp)
L531:
  mov    -0x38(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  lea    0x1(%rax),%ecx
  mov    -0x58(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <bin_append@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L521
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L521:
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L383
  mov    $0x5,%eax
  jmp    L367
L383:
  addl   $0x2,-0x44(%rbp)
L397:
  mov    -0x44(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L17
  cmpl   $0x0,0x18(%rbp)
  je     L276
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L276
L325:
  mov    -0x58(%rbp),%rax
  lea    D102(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x40(%rbp),%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xa(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L39
  mov    -0x40(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L39:
  movl   $0x0,-0x44(%rbp)
  jmp    L525
L72:
  movl   $0x0,-0x28(%rbp)
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D112(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x30(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x44(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x40(%rbp)
  jle    L226
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x4e,%al
  jne    L226
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D112(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x24(%rbp)
  movl   $0x2,-0x30(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x2c(%rbp)
L226:
  mov    -0x44(%rbp),%eax
  add    $0x2,%eax
  cmp    %eax,-0x40(%rbp)
  jle    L519
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x4e,%al
  jne    L519
  mov    -0x48(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D112(%rip),%rax
  mov    %rax,%rdi
  call   <posn@plt>
  mov    %eax,-0x20(%rbp)
  movl   $0x3,-0x30(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x2c(%rbp)
L519:
  mov    -0x30(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  lea    0x1(%rax),%ecx
  mov    -0x58(%rbp),%rdx
  mov    -0x2c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <bin_append@plt>
  cmpl   $0x0,0x18(%rbp)
  je     L615
  mov    -0x2c(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L615:
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x80,%eax
  jle    L156
  mov    $0x5,%eax
  jmp    L367
L156:
  addl   $0x3,-0x44(%rbp)
L525:
  mov    -0x44(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L72
  cmpl   $0x0,0x18(%rbp)
  je     L192
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L192
L255:
  nop
  jmp    L160
L544:
  nop
  jmp    L160
L276:
  nop
  jmp    L160
L192:
  nop
L160:
  mov    -0x40(%rbp),%eax
  add    %eax,-0x48(%rbp)
  mov    -0x48(%rbp),%eax
  cltq
  mov    -0x70(%rbp),%rdx
  sub    $0x1,%rdx
  cmp    %rdx,%rax
  jb     L312
  mov    $0x0,%eax
L367:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L158
  call   <__stack_chk_fail@plt>
L158:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D107
data_type: string
name: read_data
arguments: data_tag: D162
data_type: string
name: read_data
arguments: data_tag: D83
data_type: string
name: read_data
arguments: data_tag: D29
data_type: string
name: read_data
arguments: data_tag: D43
data_type: string
name: read_data
arguments: data_tag: D99
data_type: string
name: read_data
arguments: data_tag: D111
data_type: string
name: read_data
arguments: data_tag: D113
data_type: string
name: read_data
arguments: data_tag: D94
data_type: string
name: read_data
arguments: data_tag: D102
data_type: string
name: read_data
arguments: data_tag: D9
data_type: string
name: read_data
arguments: data_tag: D112
data_type: string
name: read_data
arguments: data_tag: D25
data_type: string

tool: 

tool: D162: K

tool: D83: Kanji block (length %d)
	

tool: D29: 0x%4X 

tool: D43: B

tool: D99: Byte block (length %d)
	

tool: D111: A

tool: D113: Alpha block (length %d)
	

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

tool: D102: N

tool: D9: Number block (length %d)
	

tool: D112: 0123456789

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

assistant: ```c
int micro_qr_intermediate(char binary[], const int jisdata[], const char mode[], const size_t length, int *kanji_used, int *alphanum_used, int *byte_used, const int debug) {
  int position = 0;
  int i;
  char buffer[2];
  strcpy(binary, "");
  if (debug) {
    for (i = 0; i < length; i++) {
      printf("%c", mode[i]);
    }
    printf("\n");
  }
  do {
    char data_block;
    int short_data_block_length = 0;
    if (strlen(binary) > 128) {
      return 5;
    }
    data_block = mode[position];
    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 prod;
        if (jis >= 0x8140 && jis <= 0x9ffc)
          jis -= 0x8140;
        else if (jis >= 0xe040 && jis <= 0xebbf)
          jis -= 0xc140;
        prod = ((jis >> 8) * 0xc0) + (jis & 0xff);
        bin_append(prod, 13, binary);
        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];
        bin_append(byte, 8, binary);
        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, prod;
        first = posn("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:", (char)jisdata[position + i]);
        count = 1;
        prod = first;
        if (i + 1 < short_data_block_length && mode[position + i + 1] == 'A') {
          int second = posn("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:", (char)jisdata[position + i + 1]);
          count = 2;
          prod = (first * 45) + second;
        }
        bin_append(prod, 1 + (5 * count), binary);
        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, prod;
        first = posn("0123456789", (char)jisdata[position + i]);
        count = 1;
        prod = first;
        if (i + 1 < short_data_block_length && mode[position + i + 1] == 'N') {
          int 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') {
          int third = posn("0123456789", (char)jisdata[position + i + 2]);
          count = 3;
          prod = (prod * 10) + third;
        }
        bin_append(prod, 1 + (3 * count), binary);
        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;
}
```