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

```asm
<micro_qr_m2>:
  endbr64
  push   %r15
  xor    %r15d,%r15d
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  cmp    $0x2,%esi
  setne  %r15b
  call   <strlen@plt>
  lea    0x20(,%r15,8),%r15d
  mov    %r15d,%r14d
  sub    %eax,%r14d
  cmp    $0x5,%r14d
  jg     L164
  xor    %ebx,%ebx
  lea    D44(%rip),%r12
  test   %r14d,%r14d
  jle    L9
  nopl   (%rax)
L174:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  add    $0x1,%ebx
  call   <concat@plt>
  cmp    %ebx,%r14d
  jne    L174
L9:
  xor    %r14d,%r14d
  cmp    $0x2,%r13d
  sete   %r14b
  xor    %r12d,%r12d
  add    $0x5,%r14d
  cmp    $0x2,%r13d
  lea    0xb(%rsp),%r13
  setne  %r12b
  xor    %esi,%esi
  add    $0x4,%r12d
  cmp    $0x8,%r12d
  jb     L104
  mov    %r12d,%eax
  lea    0x10(%rsp),%rdi
  movq   $0x0,0xb(%rsp)
  movq   $0x0,-0x8(%r13,%rax,1)
  mov    %r13,%rax
  sub    %rdi,%rax
  add    %r12d,%eax
  and    $0xfffffff8,%eax
  cmp    $0x8,%eax
  jb     L148
  and    $0xfffffff8,%eax
  mov    %eax,%edx
  xor    %eax,%eax
L165:
  mov    %eax,%ecx
  add    $0x8,%eax
  mov    %rsi,(%rdi,%rcx,1)
  cmp    %edx,%eax
  jb     L165
L148:
  lea    -0x1(%r12),%edx
  mov    %rbp,%rax
  mov    %r13,%rcx
  xor    %edi,%edi
  lea    0x8(%rbp,%rdx,8),%r11
  mov    $0xffffffc0,%r10d
  mov    $0x40,%r9d
  mov    $0xffffff80,%r8d
  nopl   (%rax)
L194:
  cmpb   $0x31,(%rax)
  mov    %edi,%edx
  mov    %r9d,%esi
  cmove  %r8d,%edx
  cmove  %r10d,%esi
  cmpb   $0x31,0x1(%rax)
  mov    %dl,(%rcx)
  jne    L14
  mov    %sil,(%rcx)
  mov    %esi,%edx
L14:
  cmpb   $0x31,0x2(%rax)
  jne    L50
  add    $0x20,%edx
  mov    %dl,(%rcx)
L50:
  cmpb   $0x31,0x3(%rax)
  jne    L116
  add    $0x10,%edx
  mov    %dl,(%rcx)
L116:
  cmpb   $0x31,0x4(%rax)
  jne    L31
  add    $0x8,%edx
  mov    %dl,(%rcx)
L31:
  cmpb   $0x31,0x5(%rax)
  jne    L26
  add    $0x4,%edx
  mov    %dl,(%rcx)
L26:
  cmpb   $0x31,0x6(%rax)
  jne    L233
  add    $0x2,%edx
  mov    %dl,(%rcx)
L233:
  cmpb   $0x31,0x7(%rax)
  jne    L228
  add    $0x1,%edx
  mov    %dl,(%rcx)
L228:
  add    $0x8,%rax
  add    $0x1,%rcx
  cmp    %r11,%rax
  jne    L194
  mov    $0x11d,%edi
  lea    0x11(%rsp),%rbx
  call   <rs_init_gf@plt>
  xor    %esi,%esi
  mov    %r14d,%edi
  call   <rs_init_code@plt>
  mov    %rbx,%rdx
  mov    %r12d,%edi
  mov    %r13,%rsi
  call   <rs_encode@plt>
  xor    %eax,%eax
  call   <rs_free@plt>
  movslq %r14d,%rax
  lea    0xf(%rsp,%rax,1),%r12
  lea    -0x1(%rbx,%rax,1),%rbx
  lea    -0x1(%r14),%eax
  sub    %rax,%r12
  cs nopw 0x0(%rax,%rax,1)
L170:
  movzbl (%rbx),%esi
  mov    $0x80,%edx
  mov    %rbp,%rdi
  sub    $0x1,%rbx
  call   <qr_diran@plt>
  cmp    %rbx,%r12
  jne    L170
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L100
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L104:
  test   $0x4,%r12b
  jne    L30
  test   %r12d,%r12d
  je     L148
  movb   $0x0,0xb(%rsp)
  test   $0x2,%r12b
  je     L148
  mov    %r12d,%eax
  xor    %edx,%edx
  mov    %dx,-0x2(%r13,%rax,1)
  jmp    L148
  nopw   0x0(%rax,%rax,1)
L164:
  lea    D22(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%ebx
  call   <concat@plt>
  mov    %rbp,%rdi
  lea    D44(%rip),%r12
  call   <strlen@plt>
  cltd
  shr    $0x1d,%edx
  add    %edx,%eax
  and    $0x7,%eax
  sub    %eax,%edx
  lea    0x8(%rdx),%r14d
  je     L266
  nopl   0x0(%rax)
L188:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  add    $0x1,%ebx
  call   <concat@plt>
  cmp    %ebx,%r14d
  jne    L188
L266:
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    D45(%rip),%rsi
  mov    %eax,%r8d
  mov    %r15d,%eax
  lea    D11(%rip),%r15
  mov    %rsi,%r14
  sub    %r8d,%eax
  lea    0x7(%rax),%r12d
  cmovns %eax,%r12d
  xor    %ebx,%ebx
  sar    $0x3,%r12d
  cmp    $0x7,%eax
  jg     L260
  jmp    L9
  nopl   (%rax)
L121:
  test   $0x1,%bl
  mov    %r14,%rsi
  cmovne %r15,%rsi
L260:
  mov    %rbp,%rdi
  add    $0x1,%ebx
  call   <concat@plt>
  cmp    %ebx,%r12d
  jg     L121
  jmp    L9
L30:
  mov    %r12d,%eax
  movl   $0x0,0xb(%rsp)
  movl   $0x0,-0x4(%r13,%rax,1)
  jmp    L148
L100:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D44
type_guessed: string
name: read_data
arguments: tag: D22
type_guessed: string
name: read_data
arguments: tag: D45
type_guessed: string
name: read_data
arguments: tag: D11
type_guessed: string

tool: D44: 0

tool: D22: 00000

tool: D45: 11101100

tool: D11: 00010001

assistant: ```c
void micro_qr_m2(char binary_data[], int ecc_mode) {
  int i, latch;
  int bits_total, bits_left, remainder;
  int data_codewords, ecc_codewords;
  unsigned char data_blocks[6], ecc_blocks[7];
  latch = 0;
  if (ecc_mode == 1) {
    bits_total = 40;
  }
  if (ecc_mode == 2) {
    bits_total = 32;
  }
  bits_left = bits_total - strlen(binary_data);
  if (bits_left <= 5) {
    for (i = 0; i < bits_left; i++) {
      concat(binary_data, "0");
    }
    latch = 1;
  } else {
    concat(binary_data, "00000");
  }
  if (latch == 0) {
    remainder = 8 - (strlen(binary_data) % 8);
    if (remainder == 8) {
      remainder = 0;
    }
    for (i = 0; i < remainder; i++) {
      concat(binary_data, "0");
    }
    bits_left = bits_total - strlen(binary_data);
    remainder = bits_left / 8;
    for (i = 0; i < remainder; i++) {
      concat(binary_data, i & 1 ? "00010001" : "11101100");
    }
  }
  if (ecc_mode == 1) {
    data_codewords = 5;
    ecc_codewords = 5;
  }
  if (ecc_mode == 2) {
    data_codewords = 4;
    ecc_codewords = 6;
  }
  for (i = 0; i < data_codewords; i++) {
    data_blocks[i] = 0;
    if (binary_data[i * 8] == '1') {
      data_blocks[i] += 0x80;
    }
    if (binary_data[(i * 8) + 1] == '1') {
      data_blocks[i] += 0x40;
    }
    if (binary_data[(i * 8) + 2] == '1') {
      data_blocks[i] += 0x20;
    }
    if (binary_data[(i * 8) + 3] == '1') {
      data_blocks[i] += 0x10;
    }
    if (binary_data[(i * 8) + 4] == '1') {
      data_blocks[i] += 0x08;
    }
    if (binary_data[(i * 8) + 5] == '1') {
      data_blocks[i] += 0x04;
    }
    if (binary_data[(i * 8) + 6] == '1') {
      data_blocks[i] += 0x02;
    }
    if (binary_data[(i * 8) + 7] == '1') {
      data_blocks[i] += 0x01;
    }
  }
  rs_init_gf(0x11d);
  rs_init_code(ecc_codewords, 0);
  rs_encode(data_codewords, data_blocks, ecc_blocks);
  rs_free();
  for (i = 0; i < ecc_codewords; i++) {
    qr_diran(binary_data, ecc_blocks[ecc_codewords - i - 1], 0x80);
  }
  return;
}
```