user: Converte this assembly snippet into its equivalent C code:

```asm
<muldivmod>:
  endbr64
  push   %r15
  mov    %edx,%eax
  mov    %ecx,%r15d
  push   %r14
  mov    %edx,%r14d
  and    $0x7,%eax
  push   %r13
  and    $0xf0,%r14d
  mov    %r9,%r13
  push   %r12
  mov    %r8d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x18,%rsp
  cmp    $0x30,%r14d
  sete   %dl
  cmp    $0x90,%r14d
  mov    %eax,0x8(%rsp)
  sete   %al
  or     %al,%dl
  mov    %dl,0xf(%rsp)
  jne    L80
L66:
  test   %r12d,%r12d
  jne    L149
L11:
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <emit_push@plt>
  test   %r13,%r13
  je     L119
L136:
  mov    %r13,%rdx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <emit_load_imm@plt>
L33:
  xor    %edx,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <emit_mov@plt>
  cmpb   $0x0,0xf(%rsp)
  jne    L75
  cmpl   $0x7,0x8(%rsp)
  je     L98
L51:
  mov    $0x1,%ecx
  cmp    $0x20,%r14d
  je     L37
  mov    $0x6,%edx
  mov    $0xf7,%esi
  mov    %rbp,%rdi
  call   <emit_alu32@plt>
  cmp    $0x2,%r12d
  je     L188
  cmp    $0x90,%r14d
  je     L120
L56:
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <emit_pop@plt>
  test   %r12d,%r12d
  jne    L188
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L149:
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <emit_push@plt>
  cmp    $0x2,%r12d
  jne    L11
  test   %r13,%r13
  jne    L136
L119:
  mov    $0x1,%edx
  mov    %r15d,%esi
  mov    %rbp,%rdi
  call   <emit_mov@plt>
  jmp    L33
  nopw   0x0(%rax,%rax,1)
L37:
  mov    $0x4,%edx
  mov    $0xf7,%esi
  mov    %rbp,%rdi
  call   <emit_alu32@plt>
  cmp    $0x2,%r12d
  jne    L56
L188:
  and    $0xe0,%ebx
  cmp    $0x20,%ebx
  jne    L41
  mov    %r12d,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <emit_mov@plt>
L41:
  add    $0x18,%rsp
  mov    %rbp,%rdi
  xor    %esi,%esi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1130 <emit_pop@plt>
L80:
  mov    %rsi,%rdx
  mov    $0x1,%esi
  call   <emit_load_imm@plt>
  cmpl   $0x7,0x8(%rsp)
  mov    %r15d,%ecx
  mov    %r15d,%edx
  mov    $0x85,%esi
  mov    %rbp,%rdi
  je     L102
  call   <emit_alu32@plt>
L183:
  mov    $0xfffffffe,%edx
  mov    $0x84,%esi
  mov    %rbp,%rdi
  call   <emit_jcc@plt>
  jmp    L66
  nopw   0x0(%rax,%rax,1)
L75:
  mov    $0x2,%ecx
  mov    $0x2,%edx
  mov    $0x31,%esi
  mov    %rbp,%rdi
  call   <emit_alu32@plt>
  cmpl   $0x7,0x8(%rsp)
  jne    L51
L98:
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <emit_rex@plt>
  jmp    L51
  nopl   0x0(%rax,%rax,1)
L120:
  mov    $0x2,%esi
  mov    %rbp,%rdi
  mov    %r12d,%edx
  call   <emit_mov@plt>
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <emit_pop@plt>
  test   %r12d,%r12d
  jne    L41
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L102:
  call   <emit_alu64@plt>
  jmp    L183
```

assistant: ```c
void muldivmod(struct jit_state *state, uint16_t pc, uint8_t opcode, int src, int dst, int32_t imm) {
  bool mul = (opcode & 0xf0) == ((0x04 | 0x00 | 0x20) & 0xf0);
  bool div = (opcode & 0xf0) == ((0x04 | 0x00 | 0x30) & 0xf0);
  bool mod = (opcode & 0xf0) == ((0x04 | 0x00 | 0x90) & 0xf0);
  bool is64 = (opcode & 0x07) == 0x07;
  if (div || mod) {
    emit_load_imm(state, 1, pc);
    if (is64) {
      emit_alu64(state, 0x85, src, src);
    } else {
      emit_alu32(state, 0x85, src, src);
    }
    emit_jcc(state, 0x84, -2);
  }
  if (dst != 0) {
    emit_push(state, 0);
  }
  if (dst != 2) {
    emit_push(state, 2);
  }
  if (imm) {
    emit_load_imm(state, 1, imm);
  } else {
    emit_mov(state, src, 1);
  }
  emit_mov(state, dst, 0);
  if (div || mod) {
    emit_alu32(state, 0x31, 2, 2);
  }
  if (is64) {
    emit_rex(state, 1, 0, 0, 0);
  }
  emit_alu32(state, 0xf7, mul ? 4 : 6, 1);
  if (dst != 2) {
    if (mod) {
      emit_mov(state, 2, dst);
    }
    emit_pop(state, 2);
  }
  if (dst != 0) {
    if (div || mul) {
      emit_mov(state, 0, dst);
    }
    emit_pop(state, 0);
  }
}
```