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    L12
L91:
  test   %r12d,%r12d
  jne    L134
L44:
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <emit_push@plt>
  test   %r13,%r13
  je     L70
L183:
  mov    %r13,%rdx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <emit_load_imm@plt>
L21:
  xor    %edx,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <emit_mov@plt>
  cmpb   $0x0,0xf(%rsp)
  jne    L189
  cmpl   $0x7,0x8(%rsp)
  je     L178
L23:
  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     L137
  cmp    $0x90,%r14d
  je     L45
L188:
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <emit_pop@plt>
  test   %r12d,%r12d
  jne    L137
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L134:
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <emit_push@plt>
  cmp    $0x2,%r12d
  jne    L44
  test   %r13,%r13
  jne    L183
L70:
  mov    $0x1,%edx
  mov    %r15d,%esi
  mov    %rbp,%rdi
  call   <emit_mov@plt>
  jmp    L21
  nopw   0x0(%rax,%rax,1)
L37:
  mov    $0x4,%edx
  mov    $0xf7,%esi
  mov    %rbp,%rdi
  call   <emit_alu32@plt>
  cmp    $0x2,%r12d
  jne    L188
L137:
  and    $0xe0,%ebx
  cmp    $0x20,%ebx
  jne    L79
  mov    %r12d,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <emit_mov@plt>
L79:
  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>
L12:
  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     L184
  call   <emit_alu32@plt>
L138:
  mov    $0xfffffffe,%edx
  mov    $0x84,%esi
  mov    %rbp,%rdi
  call   <emit_jcc@plt>
  jmp    L91
  nopw   0x0(%rax,%rax,1)
L189:
  mov    $0x2,%ecx
  mov    $0x2,%edx
  mov    $0x31,%esi
  mov    %rbp,%rdi
  call   <emit_alu32@plt>
  cmpl   $0x7,0x8(%rsp)
  jne    L23
L178:
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <emit_rex@plt>
  jmp    L23
  nopl   0x0(%rax,%rax,1)
L45:
  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    L79
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L184:
  call   <emit_alu64@plt>
  jmp    L138
```

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);
  }
}
```