user: 请将以下的汇编代码转换成C语言代码：

```asm
<expmod>:
  endbr64
  mov    $0x1,%r8d
  test   %rsi,%rsi
  je     L107
  push   %r12
  mov    %rdi,%r12
  mov    %rsi,%rdi
  mov    %rsi,%rcx
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x8,%rsp
  and    $0x1,%edi
  je     L59
  mov    %rsi,%rax
  sub    $0x1,%rax
  je     L72
  test   $0x1,%al
  je     L62
  mov    %rsi,%rdx
  mov    %r12,%rax
  sub    $0x2,%rdx
  je     L21
  test   $0x1,%dl
  je     L176
  mov    %rbx,%rdx
  lea    -0x3(%rsi),%rsi
  mov    %r12,%rdi
  call   <expmod>
  imul   %r12,%rax
  cqto
  idiv   %rbx
  mov    %rdx,%rax
  imul   %r12,%rax
L21:
  cqto
  idiv   %rbx
  imul   %rdx,%r12
L72:
  mov    %r12,%rax
  add    $0x8,%rsp
  cqto
  idiv   %rbx
  pop    %rbx
  pop    %r12
  mov    %rdx,%r8
  mov    %r8,%rax
  ret
  nop
L59:
  shr    $0x3f,%rsi
  mov    $0x1,%edi
  add    %rcx,%rsi
  sar    %rsi
  je     L82
  test   $0x1,%sil
  je     L63
  mov    %rsi,%rax
  sub    $0x1,%rax
  je     L45
  test   $0x1,%al
  je     L175
  mov    %r12,%rdi
  sub    $0x2,%rsi
  call   <expmod>
  imul   %r12,%rax
  cqto
  idiv   %rbx
  imul   %rdx,%r12
L45:
  mov    %r12,%rax
  cqto
  idiv   %rbx
  mov    %rdx,%rdi
L82:
  call   <square@plt>
  add    $0x8,%rsp
  cqto
  idiv   %rbx
  pop    %rbx
  pop    %r12
  mov    %rdx,%r8
  mov    %r8,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L107:
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L62:
  mov    %rax,%rsi
  shr    $0x3f,%rsi
  add    %rax,%rsi
  sar    %rsi
  je     L14
  test   $0x1,%sil
  je     L186
  mov    %r12,%rdi
  sub    $0x1,%rsi
  call   <expmod>
  imul   %r12,%rax
  cqto
  idiv   %rbx
  mov    %rdx,%rdi
L14:
  call   <square@plt>
  cqto
  idiv   %rbx
  imul   %rdx,%r12
  jmp    L72
  nopl   0x0(%rax)
L63:
  test   %rcx,%rcx
  lea    0x3(%rcx),%rsi
  mov    $0x1,%edi
  cmovns %rcx,%rsi
  sar    $0x2,%rsi
  je     L99
  test   $0x1,%sil
  je     L124
  mov    %r12,%rdi
  sub    $0x1,%rsi
  call   <expmod>
  imul   %r12,%rax
  cqto
  idiv   %rbx
  mov    %rdx,%rdi
L99:
  call   <square@plt>
  cqto
  idiv   %rbx
  mov    %rdx,%rdi
  jmp    L82
  cs nopw 0x0(%rax,%rax,1)
L175:
  mov    %rax,%rsi
  mov    %r12,%rdi
  shr    $0x3f,%rsi
  add    %rax,%rsi
  sar    %rsi
  call   <expmod>
  mov    %rax,%rdi
  call   <square@plt>
  cqto
  idiv   %rbx
  imul   %rdx,%r12
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L124:
  test   %rcx,%rcx
  lea    0x7(%rcx),%rsi
  mov    %r12,%rdi
  cmovns %rcx,%rsi
  sar    $0x3,%rsi
  call   <expmod>
  mov    %rax,%rdi
  call   <square@plt>
  cqto
  idiv   %rbx
  mov    %rdx,%rdi
  jmp    L99
  nopl   0x0(%rax)
L176:
  mov    %rdx,%rsi
  mov    %r12,%rdi
  shr    $0x3f,%rsi
  add    %rdx,%rsi
  mov    %rbx,%rdx
  sar    %rsi
  call   <expmod>
  mov    %rax,%rdi
  call   <square@plt>
  cqto
  idiv   %rbx
  mov    %rdx,%rax
  imul   %r12,%rax
  jmp    L21
  nopl   0x0(%rax)
L186:
  test   %rax,%rax
  lea    0x2(%rcx),%rsi
  mov    %r12,%rdi
  cmovns %rax,%rsi
  sar    $0x2,%rsi
  call   <expmod>
  mov    %rax,%rdi
  call   <square@plt>
  cqto
  idiv   %rbx
  mov    %rdx,%rdi
  jmp    L14
```

assistant: ```c
long long expmod(long long base, long long exp, long long mod) {
  if (exp == 0)
    return 1;
  if (exp & 1)
    return (base * expmod(base, exp - 1, mod)) % mod;
  else
    return square(expmod(base, exp / 2, mod)) % mod;
}
```