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

```asm
<coins>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %rdi,0xa8(%rsp)
  mov    %rdx,0x80(%rsp)
  movq   $0x1,0xa0(%rsp)
  test   %rdi,%rdi
  je     L49
  movq   $0x0,0xa0(%rsp)
  js     L49
  mov    %rsi,%r15
  cmp    $0x7,%rdx
  jg     L49
L314:
  mov    0x80(%rsp),%rdx
  mov    0xa8(%rsp),%rsi
  mov    (%r15,%rdx,8),%rax
  sub    %rax,%rsi
  mov    %rsi,0x90(%rsp)
  je     L265
  js     L255
  mov    %rdx,0x68(%rsp)
  movq   $0x0,0x98(%rsp)
L200:
  mov    0x90(%rsp),%rsi
  sub    %rax,%rsi
  mov    %rsi,0x78(%rsp)
  je     L25
  js     L107
  mov    0x78(%rsp),%rsi
  mov    0x68(%rsp),%rcx
  movq   $0x0,0x88(%rsp)
  sub    %rax,%rsi
  mov    %rcx,0x50(%rsp)
  mov    %rsi,0x60(%rsp)
  je     L1
L372:
  js     L423
  mov    0x60(%rsp),%rsi
  mov    0x50(%rsp),%rdx
  movq   $0x0,0x70(%rsp)
  sub    %rax,%rsi
  mov    %rdx,0x38(%rsp)
  mov    %rsi,0x48(%rsp)
  je     L344
L165:
  js     L343
  mov    0x38(%rsp),%rdx
  mov    %r15,%r14
  movq   $0x0,0x58(%rsp)
  mov    %rdx,0x18(%rsp)
  mov    0x48(%rsp),%rdx
  sub    %rax,%rdx
  mov    %rdx,0x30(%rsp)
  je     L134
L257:
  js     L154
  mov    0x30(%rsp),%rcx
  mov    0x18(%rsp),%rdx
  movq   $0x0,0x40(%rsp)
  sub    %rax,%rcx
  mov    %rdx,0x8(%rsp)
  mov    %rcx,0x10(%rsp)
  je     L128
L316:
  js     L322
  mov    0x10(%rsp),%rcx
  mov    0x8(%rsp),%rbp
  mov    %r14,%r15
  movq   $0x0,0x20(%rsp)
  sub    %rax,%rcx
  mov    %rcx,(%rsp)
  je     L78
L58:
  js     L93
  mov    (%rsp),%r12
  xor    %esi,%esi
  mov    %rbp,0x28(%rsp)
  mov    %rbp,%r13
  mov    %rsi,%r14
  mov    %r15,%rbp
  sub    %rax,%r12
  je     L279
L140:
  js     L302
  mov    %r13,%rbx
  xor    %r15d,%r15d
L122:
  mov    %r12,%rdi
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  add    $0x1,%rbx
  sub    %rax,%rdi
  call   <coins>
  add    %rax,%r15
  cmp    $0x8,%rbx
  je     L345
  mov    0x0(%rbp,%rbx,8),%rax
  jmp    L122
L65:
  mov    0x98(%rsp),%rsi
  add    %rsi,0xa0(%rsp)
L255:
  addq   $0x1,0x80(%rsp)
  mov    0x80(%rsp),%rax
  cmp    $0x8,%rax
  jne    L314
L49:
  mov    0xa0(%rsp),%rax
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L345:
  add    %r15,%r14
L302:
  add    $0x1,%r13
  cmp    $0x8,%r13
  je     L420
L365:
  mov    0x0(%rbp,%r13,8),%rax
  mov    (%rsp),%r12
  sub    %rax,%r12
  jne    L140
L279:
  add    $0x1,%r13
  add    $0x1,%r14
  cmp    $0x8,%r13
  jne    L365
L420:
  add    %r14,0x20(%rsp)
  mov    %rbp,%r15
  mov    0x28(%rsp),%rbp
L93:
  add    $0x1,%rbp
  cmp    $0x8,%rbp
  je     L409
L9:
  mov    (%r15,%rbp,8),%rax
  mov    0x10(%rsp),%rcx
  sub    %rax,%rcx
  mov    %rcx,(%rsp)
  jne    L58
L78:
  add    $0x1,%rbp
  addq   $0x1,0x20(%rsp)
  cmp    $0x8,%rbp
  jne    L9
L409:
  mov    0x20(%rsp),%rdx
  add    %rdx,0x40(%rsp)
  mov    %r15,%r14
L322:
  addq   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%rax
  cmp    $0x8,%rax
  je     L399
  mov    0x8(%rsp),%rax
  mov    0x30(%rsp),%rcx
  mov    (%r14,%rax,8),%rax
  sub    %rax,%rcx
  mov    %rcx,0x10(%rsp)
  jne    L316
L128:
  addq   $0x1,0x40(%rsp)
  jmp    L322
  nopl   0x0(%rax)
L399:
  mov    0x40(%rsp),%rcx
  add    %rcx,0x58(%rsp)
L154:
  addq   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%rax
  cmp    $0x8,%rax
  je     L427
  mov    0x18(%rsp),%rax
  mov    0x48(%rsp),%rdx
  mov    (%r14,%rax,8),%rax
  sub    %rax,%rdx
  mov    %rdx,0x30(%rsp)
  jne    L257
L134:
  addq   $0x1,0x58(%rsp)
  jmp    L154
  nop
L427:
  mov    0x58(%rsp),%rcx
  add    %rcx,0x70(%rsp)
  mov    %r14,%r15
L343:
  addq   $0x1,0x38(%rsp)
  mov    0x38(%rsp),%rax
  cmp    $0x8,%rax
  je     L167
  mov    0x38(%rsp),%rax
  mov    0x60(%rsp),%rsi
  mov    (%r15,%rax,8),%rax
  sub    %rax,%rsi
  mov    %rsi,0x48(%rsp)
  jne    L165
L344:
  addq   $0x1,0x70(%rsp)
  jmp    L343
  nopw   0x0(%rax,%rax,1)
L167:
  mov    0x70(%rsp),%rsi
  add    %rsi,0x88(%rsp)
L423:
  addq   $0x1,0x50(%rsp)
  mov    0x50(%rsp),%rax
  cmp    $0x8,%rax
  je     L219
  mov    0x50(%rsp),%rax
  mov    0x78(%rsp),%rsi
  mov    (%r15,%rax,8),%rax
  sub    %rax,%rsi
  mov    %rsi,0x60(%rsp)
  jne    L372
L1:
  addq   $0x1,0x88(%rsp)
  jmp    L423
L219:
  mov    0x88(%rsp),%rcx
  add    %rcx,0x98(%rsp)
L107:
  addq   $0x1,0x68(%rsp)
  mov    0x68(%rsp),%rax
  cmp    $0x8,%rax
  je     L65
  mov    0x68(%rsp),%rax
  mov    (%r15,%rax,8),%rax
  jmp    L200
L25:
  addq   $0x1,0x98(%rsp)
  jmp    L107
L265:
  addq   $0x1,0xa0(%rsp)
  jmp    L255
```

assistant: ```c
long int coins(long int balance, long int *values, long int index) {
  if (0 == balance)
    return 1;
  if (balance < 0)
    return 0;
  long int sum = 0;
  for (long int i = index; i < 8; i++) {
    sum += coins(balance - values[i], values, i);
  }
  return sum;
}
```