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

```asm
<getBinaryLength>:
  endbr64
  push   %r15
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  push   %r12
  mov    %r8d,%r12d
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x28,%rsp
  mov    %rdx,0x8(%rsp)
  mov    %ecx,%edx
  mov    %edi,0x1c(%rsp)
  call   <applyOptimisation@plt>
  cmp    $0x1,%r12d
  sete   %r12b
  movzbl %r12b,%r12d
  shl    $0x2,%r12d
  cmp    $0x3,%r14d
  lea    0xc(%r12),%eax
  cmovne %eax,%r12d
  movslq %ebp,%rax
  mov    %rax,0x10(%rsp)
  test   %ebp,%ebp
  jle    L271
  xor    %r14d,%r14d
  mov    $0x20,%edx
  nopw   0x0(%rax,%rax,1)
L152:
  movzbl (%rbx,%r14,1),%eax
  mov    %r14d,%r13d
  cmp    %dl,%al
  je     L281
  add    $0x4,%r12d
  cmp    $0x4b,%al
  je     L259
  jg     L261
  cmp    $0x41,%al
  je     L50
  cmp    $0x42,%al
  jne    L43
  mov    0x1c(%rsp),%edi
  mov    $0x10,%ecx
  mov    $0x10,%edx
  mov    %r14,%r15
  mov    $0x8,%esi
  call   <tribus@plt>
  add    %eax,%r12d
  jmp    L222
  cs nopw 0x0(%rax,%rax,1)
L247:
  add    $0x10,%r12d
L219:
  add    $0x1,%r15
L222:
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r13d,%edi
  call   <blockLength@plt>
  add    %r13d,%eax
  cmp    %r15d,%eax
  jle    L243
  mov    0x8(%rsp),%rax
  cmpl   $0xff,(%rax,%r15,4)
  jg     L247
  add    $0x8,%r12d
  jmp    L219
  nopw   0x0(%rax,%rax,1)
L261:
  cmp    $0x4e,%al
  jne    L43
  mov    0x1c(%rsp),%edi
  mov    $0xe,%ecx
  mov    $0xc,%edx
  mov    $0xa,%esi
  call   <tribus@plt>
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r14d,%edi
  add    %eax,%r12d
  call   <blockLength@plt>
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x55555556,%rdx,%rdx
  sar    $0x1f,%ecx
  shr    $0x20,%rdx
  sub    %ecx,%edx
  lea    (%rdx,%rdx,2),%ecx
  sub    %ecx,%eax
  cmp    $0x1,%eax
  je     L160
  cmp    $0x2,%eax
  je     L230
  test   %eax,%eax
  je     L130
L243:
  movzbl (%rbx,%r14,1),%edx
L281:
  add    $0x1,%r14
  cmp    0x10(%rsp),%r14
  jne    L152
L271:
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L43:
  mov    %eax,%edx
  add    $0x1,%r14
  cmp    0x10(%rsp),%r14
  jne    L152
  jmp    L271
  nopl   0x0(%rax,%rax,1)
L259:
  mov    0x1c(%rsp),%edi
  mov    $0xc,%ecx
  mov    $0xa,%edx
  mov    $0x8,%esi
  call   <tribus@plt>
  mov    %ebp,%edx
  mov    %r14d,%edi
  mov    %rbx,%rsi
  add    %eax,%r12d
  call   <blockLength@plt>
  lea    (%rax,%rax,2),%edx
  lea    (%rax,%rdx,4),%eax
  movzbl (%rbx,%r14,1),%edx
  add    $0x1,%r14
  add    %eax,%r12d
  cmp    0x10(%rsp),%r14
  jne    L152
  jmp    L271
  nopw   0x0(%rax,%rax,1)
L50:
  mov    0x1c(%rsp),%edi
  mov    $0xd,%ecx
  mov    $0xb,%edx
  mov    $0x9,%esi
  call   <tribus@plt>
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r14d,%edi
  add    %eax,%r12d
  call   <blockLength@plt>
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  lea    (%rax,%rcx,1),%edx
  and    $0x1,%edx
  sub    %ecx,%edx
  test   $0x1,%al
  je     L145
  cmp    $0x1,%edx
  jne    L243
  mov    %ebp,%edx
  mov    %r14d,%edi
  mov    %rbx,%rsi
  call   <blockLength@plt>
  lea    -0x1(%rax),%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  lea    (%rax,%rax,4),%edx
  lea    (%rax,%rdx,2),%eax
  movzbl (%rbx,%r14,1),%edx
  add    $0x1,%r14
  lea    0x6(%r12,%rax,1),%r12d
  cmp    0x10(%rsp),%r14
  jne    L152
  jmp    L271
  nop
L145:
  mov    %ebp,%edx
  mov    %r14d,%edi
  mov    %rbx,%rsi
  call   <blockLength@plt>
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  lea    (%rax,%rax,4),%edx
  lea    (%rax,%rdx,2),%eax
  movzbl (%rbx,%r14,1),%edx
  add    $0x1,%r14
  add    %eax,%r12d
  cmp    0x10(%rsp),%r14
  jne    L152
  jmp    L271
  nopl   0x0(%rax,%rax,1)
L130:
  mov    %ebp,%edx
  mov    %r14d,%edi
  mov    %rbx,%rsi
  call   <blockLength@plt>
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sub    %eax,%edx
  lea    (%rdx,%rdx,4),%eax
  movzbl (%rbx,%r14,1),%edx
  add    $0x1,%r14
  lea    (%r12,%rax,2),%r12d
  cmp    0x10(%rsp),%r14
  jne    L152
  jmp    L271
L230:
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r14d,%edi
  call   <blockLength@plt>
  sub    $0x2,%eax
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sub    %eax,%edx
  lea    (%rdx,%rdx,4),%eax
  lea    0x7(%r12,%rax,2),%r12d
  jmp    L243
L160:
  mov    %ebp,%edx
  mov    %r14d,%edi
  mov    %rbx,%rsi
  call   <blockLength@plt>
  sub    $0x1,%eax
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sub    %eax,%edx
  lea    (%rdx,%rdx,4),%eax
  movzbl (%rbx,%r14,1),%edx
  add    $0x1,%r14
  lea    0x4(%r12,%rax,2),%r12d
  cmp    0x10(%rsp),%r14
  jne    L152
  jmp    L271
```

assistant: ```c
int getBinaryLength(int version, char inputMode[], int inputData[], int inputLength, int gs1, int eci) {
  char currentMode;
  int i, j;
  int count = 0;
  applyOptimisation(version, inputMode, inputLength);
  currentMode = ' ';
  if (gs1 == 1) {
    count += 4;
  }
  if (eci != 3) {
    count += 12;
  }
  for (i = 0; i < inputLength; i++) {
    if (inputMode[i] != currentMode) {
      count += 4;
      switch (inputMode[i]) {
      case 'K':
        count += tribus(version, 8, 10, 12);
        count += (blockLength(i, inputMode, inputLength) * 13);
        break;
      case 'B':
        count += tribus(version, 8, 16, 16);
        for (j = i; j < (i + blockLength(i, inputMode, inputLength)); j++) {
          if (inputData[j] > 0xff) {
            count += 16;
          } else {
            count += 8;
          }
        }
        break;
      case 'A':
        count += tribus(version, 9, 11, 13);
        switch (blockLength(i, inputMode, inputLength) % 2) {
        case 0:
          count += (blockLength(i, inputMode, inputLength) / 2) * 11;
          break;
        case 1:
          count += ((blockLength(i, inputMode, inputLength) - 1) / 2) * 11;
          count += 6;
          break;
        }
        break;
      case 'N':
        count += tribus(version, 10, 12, 14);
        switch (blockLength(i, inputMode, inputLength) % 3) {
        case 0:
          count += (blockLength(i, inputMode, inputLength) / 3) * 10;
          break;
        case 1:
          count += ((blockLength(i, inputMode, inputLength) - 1) / 3) * 10;
          count += 4;
          break;
        case 2:
          count += ((blockLength(i, inputMode, inputLength) - 2) / 3) * 10;
          count += 7;
          break;
        }
        break;
      }
      currentMode = inputMode[i];
    }
  }
  return count;
}
```