user: What would the C source look like for the assembly code provided here:

```asm
<calc_error>:
  endbr64
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  mov    %ecx,%edi
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  call   <is_double_rettype@plt>
  test   %rax,%rax
  mov    0x0(%rbp),%eax
  je     L69
  mov    %eax,%ecx
  and    $0x7ff00000,%ecx
  cmp    $0x7ff00000,%ecx
  je     L114
  mov    (%rbx),%edx
  mov    %edx,%esi
  and    $0x7ff00000,%esi
  cmp    $0x7ff00000,%esi
  je     L114
L281:
  xor    %edx,%eax
  js     L326
  mov    %r12d,%edi
  call   <is_double_rettype@plt>
  test   %rax,%rax
  jne    L245
  mov    0x4(%rbx),%edx
  mov    0x0(%rbp),%ecx
  neg    %edx
  mov    %ecx,%esi
  sete   %dil
  sub    (%rbx),%esi
  movzbl %dil,%eax
  lea    -0x1(%rsi,%rax,1),%esi
  xor    %eax,%eax
  cmp    %esi,%ecx
  ja     L192
  sete   %al
  movzbl %al,%eax
  and    %edi,%eax
  sub    $0x1,%eax
L192:
  test   %r13d,%r13d
  jle    L173
L183:
  cmp    $0x60,%r13d
  jg     L4
  mov    %r13d,%edi
  cmp    $0x1f,%r13d
  jle    L315
  mov    %eax,%ecx
  sub    $0x20,%edi
  sar    $0x1f,%ecx
  mov    %ecx,%r8d
  cmp    $0x1f,%edi
  jle    L408
L253:
  mov    %eax,%esi
  mov    %ecx,%eax
  sub    $0x20,%edi
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  mov    %ecx,%r8d
  cmp    $0x1f,%edi
  jg     L253
L408:
  and    $0x1f,%r13d
  jne    L417
  mov    %esi,%edx
  mov    %eax,%esi
  mov    %ecx,%eax
  jmp    L402
  nopw   0x0(%rax,%rax,1)
L114:
  test   $0x800fffff,%eax
  jne    L393
  mov    0x4(%rbp),%r8d
  test   %r8d,%r8d
  jne    L393
  test   $0xfffff,%eax
  jne    L326
  mov    (%rbx),%edx
  jmp    L354
  nopl   0x0(%rax,%rax,1)
L393:
  mov    (%rbx),%edx
  test   $0x800fffff,%edx
  je     L376
L139:
  cmp    $0x7ff00000,%ecx
  je     L325
L186:
  test   $0xfffff,%eax
  jne    L326
  mov    0x4(%rbp),%esi
  test   %esi,%esi
  jne    L326
L354:
  test   $0xfffff,%edx
  jne    L326
  mov    0x4(%rbx),%ecx
  test   %ecx,%ecx
  je     L211
  nop
L326:
  mov    D2(%rip),%rax
  mov    (%rax),%rax
L243:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L69:
  mov    %eax,%edx
  and    $0x7f800000,%edx
  cmp    $0x7f800000,%edx
  je     L362
  mov    (%rbx),%edx
  mov    %edx,%ecx
  and    $0x7f800000,%ecx
  cmp    $0x7f800000,%ecx
  jne    L281
L318:
  test   $0x7fffff,%eax
  jne    L326
  mov    (%rbx),%edx
  test   $0x7fffff,%edx
  jne    L326
L211:
  cmp    %edx,%eax
  jne    L326
L4:
  xor    %eax,%eax
L350:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L245:
  mov    0x8(%rbx),%edx
  mov    0x4(%rbp),%ecx
  neg    %edx
  mov    %ecx,%esi
  sete   %dil
  sub    0x4(%rbx),%esi
  movzbl %dil,%eax
  lea    -0x1(%rsi,%rax,1),%esi
  xor    %eax,%eax
  cmp    %esi,%ecx
  sete   %al
  and    %edi,%eax
  cmp    %esi,%ecx
  mov    $0x1,%ecx
  cmova  %ecx,%eax
  mov    0x0(%rbp),%ecx
  sub    (%rbx),%ecx
  lea    -0x1(%rax,%rcx,1),%eax
  test   %r13d,%r13d
  jg     L183
L173:
  mov    %eax,%ecx
L402:
  test   %ecx,%ecx
  js     L157
  cmp    $0x7ffff,%eax
  ja     L326
  shr    $0x14,%edx
  shl    $0xc,%esi
  or     %esi,%edx
  shl    $0x2c,%rax
  or     %rdx,%rax
  jmp    L243
  nopl   0x0(%rax,%rax,1)
L376:
  mov    0x4(%rbx),%edi
  test   %edi,%edi
  je     L186
  jmp    L139
L362:
  test   $0x807fffff,%eax
  je     L318
  mov    (%rbx),%edx
  test   $0x807fffff,%edx
  je     L318
  and    $0x7f800000,%edx
  cmp    $0x7f800000,%edx
  jne    L318
  jmp    L4
L157:
  mov    %edx,%edi
  xor    %edx,%edx
  xor    $0xffffffff,%edi
  sete   %dl
  mov    %edx,%ecx
  sub    %eax,%edx
  sub    %esi,%ecx
  sub    $0x1,%edx
  sub    $0x1,%ecx
  cmp    $0x7ffff,%edx
  ja     L326
  shr    $0x14,%edi
  shl    $0xc,%ecx
  mov    %rdx,%rax
  or     %ecx,%edi
  shl    $0x2c,%rax
  or     %rdi,%rax
  neg    %rax
  jmp    L243
  nopl   0x0(%rax)
L325:
  mov    %edx,%ecx
  and    $0x7ff00000,%ecx
  cmp    $0x7ff00000,%ecx
  jne    L186
  xor    %eax,%eax
  jmp    L350
  nopl   0x0(%rax,%rax,1)
L417:
  mov    %ecx,%r9d
L61:
  mov    $0x20,%edi
  mov    %r13d,%ecx
  mov    %eax,%edx
  sub    %r13d,%edi
  shr    %cl,%esi
  mov    %edi,%ecx
  shl    %cl,%edx
  mov    %r13d,%ecx
  shr    %cl,%eax
  or     %esi,%edx
  mov    %edi,%ecx
  mov    %r8d,%esi
  shl    %cl,%esi
  mov    %r13d,%ecx
  shr    %cl,%r8d
  or     %eax,%esi
  mov    %edi,%ecx
  mov    %r9d,%eax
  shl    %cl,%eax
  or     %r8d,%eax
  jmp    L173
  nopl   0x0(%rax,%rax,1)
L315:
  mov    %eax,%r9d
  mov    %eax,%r8d
  mov    %esi,%eax
  mov    %edx,%esi
  sar    $0x1f,%r9d
  jmp    L61
```

assistant: ```c
long long calc_error(unsigned a[2], unsigned b[3], int shift, int rettype) {
  unsigned r0, r1, r2;
  int sign, carry;
  long long result;
  if (is_double_rettype(rettype)) {
    if ((a[0] & 0x7FF00000) == 0x7FF00000 || (b[0] & 0x7FF00000) == 0x7FF00000) {
      if (((a[0] & 0x800FFFFF) || a[1]) && ((b[0] & 0x800FFFFF) || b[1]) && (a[0] & 0x7FF00000) == 0x7FF00000 && (b[0] & 0x7FF00000) == 0x7FF00000)
        return 0;
      if (!((a[0] & 0xFFFFF) || a[1]) && !((b[0] & 0xFFFFF) || b[1]) && a[0] == b[0])
        return 0;
      return LLONG_MAX;
    }
  } else {
    if ((a[0] & 0x7F800000) == 0x7F800000 || (b[0] & 0x7F800000) == 0x7F800000) {
      if ((a[0] & 0x807FFFFF) && (b[0] & 0x807FFFFF) && (a[0] & 0x7F800000) == 0x7F800000 && (b[0] & 0x7F800000) == 0x7F800000)
        return 0;
      if (!(a[0] & 0x7FFFFF) && !(b[0] & 0x7FFFFF) && a[0] == b[0])
        return 0;
      return LLONG_MAX;
    }
  }
  if ((a[0] ^ b[0]) & 0x80000000)
    return LLONG_MAX;
  if (is_double_rettype(rettype)) {
    r2 = -b[2];
    carry = (r2 == 0);
    r1 = a[1] + ~b[1] + carry;
    carry = (r1 < a[1] || (carry && r1 == a[1]));
    r0 = a[0] + ~b[0] + carry;
  } else {
    r2 = -b[1];
    carry = (r2 == 0);
    r1 = a[0] + ~b[0] + carry;
    carry = (r1 < a[0] || (carry && r1 == a[0]));
    r0 = ~0 + carry;
  }
  if (shift > 0) {
    if (shift > 32 * 3)
      return 0;
    while (shift >= 32) {
      r2 = r1;
      r1 = r0;
      r0 = -(r0 >> 31);
      shift -= 32;
    }
    if (shift > 0) {
      r2 = (r2 >> shift) | (r1 << (32 - shift));
      r1 = (r1 >> shift) | (r0 << (32 - shift));
      r0 = (r0 >> shift) | ((-(r0 >> 31)) << (32 - shift));
    }
  }
  if (r0 & 0x80000000) {
    sign = 1;
    r2 = ~r2;
    carry = (r2 == 0);
    r1 = 0 + ~r1 + carry;
    carry = (carry && (r2 == 0));
    r0 = 0 + ~r0 + carry;
  } else {
    sign = 0;
  }
  if (r0 >= (1LL << (31 - (12))))
    return LLONG_MAX;
  result = (r2 >> (32 - (12))) & ((1 << (12)) - 1);
  result |= r1 << (12);
  result |= (long long)r0 << (32 + (12));
  if (sign)
    result = -result;
  return result;
}
```