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

```asm
<do_translation>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %esi,%r14d
  mov    %rdx,0x8(%rsp)
  mov    %ecx,%r15d
  call   <next_char@plt>
  test   %eax,%eax
  js     L20
  mov    %eax,%ebx
  movl   $0x0,0x4(%rsp)
  mov    $0x0,%r12d
  mov    $0x0,%ebp
  jmp    L179
L65:
  mov    0x4(%rsp),%edi
  call   <translate_char_without_h_suffix@plt>
  movsbl %al,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  mov    %ebp,%eax
  mov    %r12d,%ebp
  mov    %eax,%r12d
  jmp    L306
L16:
  cmpl   $0x4a,0x4(%rsp)
  mov    $0x19,%edi
  mov    $0x39,%eax
  cmovne %eax,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  mov    %ebp,%r12d
  mov    $0x2,%ebp
  jmp    L306
L212:
  cmp    $0x1,%r12d
  je     L237
  cmp    $0x2,%r12d
  je     L352
L390:
  mov    %ebx,%edi
  call   <translate_char@plt>
  test   %eax,%eax
  js     L113
L164:
  movsbl %al,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  mov    %ebp,%r12d
  jmp    L306
L237:
  mov    %ebx,%esi
  mov    0x4(%rsp),%r12d
  mov    %r12d,%edi
  call   <translate_j_and_char@plt>
  test   %eax,%eax
  jns    L164
  cmp    $0x4a,%r12d
  mov    $0x19,%edi
  mov    $0x39,%eax
  cmovne %eax,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  jmp    L390
L352:
  mov    %ebx,%eax
  and    $0xffffffdf,%eax
  cmp    $0x48,%eax
  jne    L52
  mov    0x4(%rsp),%edi
  call   <translate_char_and_h_suffix@plt>
  test   %eax,%eax
  jns    L164
  jmp    L390
L52:
  mov    0x4(%rsp),%edi
  call   <translate_char_without_h_suffix@plt>
  movsbl %al,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  jmp    L390
L113:
  mov    $0x2,%r12d
  cmp    $0xfffffffe,%eax
  je     L306
  cmp    $0xfffffffd,%eax
  sete   %r12b
  movzbl %r12b,%r12d
  jmp    L306
L215:
  cmp    $0x1,%ebp
  je     L342
  cmp    $0x2,%ebp
  je     L81
  cmp    $0x3,%ebp
  je     L100
L306:
  mov    %r13,%rdi
  call   <next_char@plt>
  mov    %ebx,0x4(%rsp)
  mov    %eax,%ebx
L194:
  test   %ebx,%ebx
  js     L224
L179:
  test   %ebp,%ebp
  jne    L215
  test   %r14d,%r14d
  je     L212
  cmp    $0x3b,%ebx
  jne    L212
  cmp    $0x2,%r12d
  je     L65
  cmp    $0x1,%r12d
  je     L16
  mov    %ebp,%r12d
  mov    $0x2,%ebp
  jmp    L306
L342:
  cmp    $0x3b,%ebx
  jne    L196
  mov    %ebp,%r12d
  mov    $0x2,%ebp
  jmp    L306
L196:
  movsbl %bl,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  jmp    L306
L81:
  mov    $0x3,%ebp
  cmp    $0x3b,%ebx
  je     L306
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  mov    $0x3b,%edi
  call   <send_char@plt>
  mov    %r12d,%ebp
  jmp    L194
L100:
  cmp    $0x3b,%ebx
  je     L169
  test   %r12d,%r12d
  sete   %bpl
  movzbl %bpl,%ebp
  mov    $0x0,%r12d
  jmp    L194
L169:
  mov    %r15d,%edx
  mov    0x8(%rsp),%rbp
  mov    %rbp,%rsi
  mov    $0x3b,%edi
  call   <send_char@plt>
  mov    %r15d,%edx
  mov    %rbp,%rsi
  mov    $0x3b,%edi
  call   <send_char@plt>
  mov    %r12d,%ebp
  jmp    L306
L224:
  test   %ebp,%ebp
  je     L363
  cmp    $0x2,%ebp
  je     L287
L20:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L363:
  cmp    $0x2,%r12d
  je     L190
  cmp    $0x1,%r12d
  jne    L20
  cmpl   $0x4a,0x4(%rsp)
  mov    $0x19,%edi
  mov    $0x39,%eax
  cmovne %eax,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  jmp    L20
L190:
  mov    0x4(%rsp),%edi
  call   <translate_char_without_h_suffix@plt>
  movsbl %al,%edi
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  call   <send_char@plt>
  jmp    L20
L287:
  mov    %r15d,%edx
  mov    0x8(%rsp),%rsi
  mov    $0x3b,%edi
  call   <send_char@plt>
  jmp    L20
```

assistant: ```c
void do_translation(FILE *input_stream, int with_latin_escapes, FILE *output_stream, int output_encoding) {
  const int NORMAL = 0;
  const int AS_IS = 1;
  const int AFTER_SWITCH_CHAR = 2;
  const int AFTER_2_SWITCH_CHARS = 3;
  const int AFTER_J_PREFIX = 1;
  const int BEFORE_H_SUFFIX = 2;
  int state = NORMAL, substate = NORMAL;
  int c, prev_c = 0;
  c = next_char(input_stream);
  for (;;) {
    if (c < 0) {
      break;
    }
    if (state == NORMAL) {
      if (with_latin_escapes && c == ';') {
        if (substate == BEFORE_H_SUFFIX) {
          send_char((translate_char_without_h_suffix(prev_c)), output_stream, output_encoding);
        } else if (substate == AFTER_J_PREFIX) {
          send_char((prev_c == 'J' ? 0x419 : 0x439), output_stream, output_encoding);
        }
        substate = NORMAL;
        state = AFTER_SWITCH_CHAR;
      } else {
        int translated = -1;
        if (substate == AFTER_J_PREFIX) {
          translated = translate_j_and_char(prev_c, c);
          if (translated < 0) {
            send_char((prev_c == 'J' ? 0x419 : 0x439), output_stream, output_encoding);
          }
        } else if (substate == BEFORE_H_SUFFIX) {
          if (c == 'H' || c == 'h') {
            translated = translate_char_and_h_suffix(prev_c);
          } else {
            send_char((translate_char_without_h_suffix(prev_c)), output_stream, output_encoding);
          }
        }
        substate = NORMAL;
        if (translated < 0) {
          translated = translate_char(c);
          if (translated < 0) {
            if (translated == -2) {
              substate = BEFORE_H_SUFFIX;
            } else if (translated == -3) {
              substate = AFTER_J_PREFIX;
            }
          }
        }
        if (translated >= 0) {
          send_char((translated), output_stream, output_encoding);
        }
      }
    } else if (state == AS_IS) {
      if (c == ';') {
        substate = AS_IS;
        state = AFTER_SWITCH_CHAR;
      } else {
        send_char((c), output_stream, output_encoding);
      }
    } else if (state == AFTER_SWITCH_CHAR) {
      if (c == ';') {
        state = AFTER_2_SWITCH_CHARS;
      } else {
        send_char((';'), output_stream, output_encoding);
        state = substate;
        continue;
      }
    } else if (state == AFTER_2_SWITCH_CHARS) {
      if (c != ';') {
        state = (substate == NORMAL) ? AS_IS : NORMAL;
        substate = NORMAL;
        continue;
      } else {
        send_char((';'), output_stream, output_encoding);
        send_char((';'), output_stream, output_encoding);
        state = substate;
      }
    }
    prev_c = c;
    c = next_char(input_stream);
  }
  if (state == NORMAL) {
    if (substate == BEFORE_H_SUFFIX) {
      send_char((translate_char_without_h_suffix(prev_c)), output_stream, output_encoding);
    } else if (substate == AFTER_J_PREFIX) {
      send_char((prev_c == 'J' ? 0x419 : 0x439), output_stream, output_encoding);
    }
  } else if (state == AFTER_SWITCH_CHAR) {
    send_char((';'), output_stream, output_encoding);
  }
}
```