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

```asm
<aggiungi>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %r8,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,0xc(%rsp)
  lea    0x8(%rsp),%rbx
  mov    %edx,%esi
  mov    %edx,0x8(%rsp)
  test   %edx,%edx
  jns    L160
  jmp    L252
  nopl   0x0(%rax,%rax,1)
L318:
  mov    %rbx,%rsi
  lea    0xc(%rsp),%rdi
  call   <sposta@plt>
  mov    0x8(%rsp),%esi
  test   %esi,%esi
  js     L252
L160:
  movslq 0xc(%rsp),%rdx
  movslq %esi,%rax
  mov    0x0(%rbp,%rdx,8),%rdx
  cmpb   $0x5f,(%rdx,%rax,1)
  jne    L318
  mov    %rbp,%rdi
  mov    $0x1,%ebx
  call   <ultimo@plt>
  test   %rax,%rax
  je     L147
  movslq 0xc(%rsp),%rax
  xor    %ebx,%ebx
L273:
  cmp    $0x1,%eax
  je     L243
L203:
  cmp    $0x2,%eax
  jne    L222
  movslq 0x8(%rsp),%rdx
  mov    0x18(%rbp),%rcx
  movsbl (%rcx,%rdx,1),%r14d
  test   %ebx,%ebx
  je     L106
  mov    0x0(%rbp),%rcx
  add    $0xa,%r14d
  movsbl (%rcx,%rdx,1),%ecx
  sub    %ecx,%r14d
  mov    0x8(%rbp),%rcx
  movsbl (%rcx,%rdx,1),%edx
  sub    %edx,%r14d
  add    $0x30,%r14d
L145:
  lea    -0x1(%r14),%edx
  cmp    $0x8,%edx
  ja     L227
  nopl   0x0(%rax)
L204:
  movslq %r14d,%rdx
  lea    (%r12,%rdx,4),%r9
  mov    (%r9),%r15d
  test   %r15d,%r15d
  jne    L30
  movslq 0x8(%rsp),%rdx
  cmp    $0x1,%ebx
  je     L140
  mov    0x0(%rbp,%rax,8),%rax
  lea    0x30(%r14),%ecx
  mov    %r12,%r8
  mov    %rbp,%rdi
  movl   $0x1,(%r9)
  mov    %cl,(%rax,%rdx,1)
  mov    0x8(%rsp),%edx
  mov    %r13d,%ecx
  mov    0xc(%rsp),%esi
  mov    %r9,(%rsp)
  call   <aggiungi>
  mov    (%rsp),%r9
  cmp    $0x1,%eax
  je     L67
  movslq 0xc(%rsp),%rdx
  movslq 0x8(%rsp),%rax
  movl   $0x0,(%r9)
  mov    0x0(%rbp,%rdx,8),%rdx
  movb   $0x5f,(%rdx,%rax,1)
L30:
  cmp    $0x1,%ebx
  je     L227
L234:
  movslq 0xc(%rsp),%rax
  mov    $0x1,%ebx
  cmp    $0x1,%eax
  jne    L203
L243:
  movslq 0x8(%rsp),%rdx
  mov    0x18(%rbp),%rcx
  movsbl (%rcx,%rdx,1),%r14d
  test   %ebx,%ebx
  je     L188
  add    $0xa,%r14d
L188:
  mov    0x0(%rbp),%rcx
  movsbl (%rcx,%rdx,1),%ecx
  sub    %ecx,%r14d
  mov    0x10(%rbp),%rcx
  movsbl (%rcx,%rdx,1),%edx
  sub    %edx,%r14d
  add    $0x30,%r14d
L200:
  lea    -0x1(%r14),%edx
  cmp    $0x8,%edx
  jbe    L204
  cmp    $0x1,%ebx
  jne    L234
  nopl   0x0(%rax,%rax,1)
L227:
  xor    %r15d,%r15d
  jmp    L218
L53:
  movslq 0xc(%rsp),%rdx
  movslq 0x8(%rsp),%rax
  lea    0x30(%rbx),%ecx
  mov    %r12,%r8
  movl   $0x1,(%r12,%rbx,4)
  mov    %rbp,%rdi
  mov    0x0(%rbp,%rdx,8),%rdx
  mov    %cl,(%rdx,%rax,1)
  mov    0x8(%rsp),%edx
  mov    %r13d,%ecx
  mov    0xc(%rsp),%esi
  call   <aggiungi>
  cmp    $0x1,%eax
  je     L67
  movslq 0xc(%rsp),%rdx
  movslq 0x8(%rsp),%rax
  movl   $0x0,(%r12,%rbx,4)
  mov    0x0(%rbp,%rdx,8),%rdx
  movb   $0x5f,(%rdx,%rax,1)
L131:
  add    $0x1,%rbx
  cmp    $0xa,%rbx
  je     L227
L147:
  mov    (%r12,%rbx,4),%eax
  test   %eax,%eax
  jne    L131
  jmp    L53
  nopl   0x0(%rax,%rax,1)
L252:
  mov    %r13d,%esi
  mov    %rbp,%rdi
  xor    %r15d,%r15d
  call   <verifica_somma@plt>
  test   %rax,%rax
  setne  %r15b
L218:
  add    $0x18,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L222:
  cmp    $0x3,%eax
  jne    L200
  movslq 0x8(%rsp),%rcx
  mov    0x0(%rbp),%rdx
  mov    0x8(%rbp),%rsi
  movsbl (%rdx,%rcx,1),%edx
  movsbl (%rsi,%rcx,1),%esi
  add    %esi,%edx
  mov    0x10(%rbp),%rsi
  movsbl (%rsi,%rcx,1),%ecx
  lea    -0x90(%rdx,%rcx,1),%r14d
  test   %ebx,%ebx
  je     L93
  lea    -0x90(%rdx,%rcx,1),%ecx
  movslq %ecx,%r14
  mov    %ecx,%edx
  imul   $0x66666667,%r14,%r14
  sar    $0x1f,%edx
  sar    $0x22,%r14
  sub    %edx,%r14d
  lea    (%r14,%r14,4),%edx
  add    %edx,%edx
  sub    %edx,%ecx
  mov    %ecx,%r14d
  jmp    L145
L106:
  mov    0x0(%rbp),%rcx
  movsbl (%rcx,%rdx,1),%ecx
  sub    %ecx,%r14d
  mov    0x8(%rbp),%rcx
  movsbl (%rcx,%rdx,1),%edx
  sub    %edx,%r14d
  add    $0x30,%r14d
L93:
  lea    -0x1(%r14),%edx
  cmp    $0x8,%edx
  jbe    L204
  mov    $0x1,%ebx
  jmp    L273
L67:
  mov    $0x1,%r15d
  jmp    L218
L140:
  test   %edx,%edx
  je     L227
  mov    0x0(%rbp,%rax,8),%rax
  add    $0x30,%r14d
  movl   $0x1,(%r9)
  mov    %r14b,(%rax,%rdx,1)
  movslq 0x8(%rsp),%rdx
  test   %edx,%edx
  jle    L103
  mov    0x0(%rbp),%rax
  movb   $0x31,-0x1(%rax,%rdx,1)
  mov    0x8(%rsp),%edx
L103:
  mov    0xc(%rsp),%esi
  mov    %r12,%r8
  mov    %r13d,%ecx
  mov    %rbp,%rdi
  mov    %r9,(%rsp)
  call   <aggiungi>
  mov    (%rsp),%r9
  cmp    $0x1,%eax
  je     L67
  movslq 0xc(%rsp),%rdx
  movslq 0x8(%rsp),%rax
  movl   $0x0,(%r9)
  mov    0x0(%rbp,%rdx,8),%rdx
  movb   $0x5f,(%rdx,%rax,1)
  movslq 0x8(%rsp),%rax
  mov    0x0(%rbp),%rdx
  movb   $0x30,-0x1(%rdx,%rax,1)
  jmp    L218
```

assistant: ```c
int aggiungi(char **m, int r, int c, int n, int *preso) {
  while (c >= 0 && m[r][c] != '_')
    sposta(&r, &c);
  if (c < 0) {
    if (verifica_somma(m, n))
      return 1;
    return 0;
  }
  if (ultimo(m, c)) {
    int i, x;
    for (i = 0; i < 2; i++) {
      if (r == 1 && i == 0)
        x = m[3][c] - m[0][c] - m[2][c] + '0';
      if (r == 1 && i == 1)
        x = 10 + m[3][c] - m[0][c] - m[2][c] + '0';
      if (r == 2 && i == 0)
        x = m[3][c] - m[0][c] - m[1][c] + '0';
      if (r == 2 && i == 1)
        x = 10 + m[3][c] - m[0][c] - m[1][c] + '0';
      if (r == 3 && i == 0)
        x = m[0][c] + m[1][c] + m[2][c] - 3 * '0';
      if (r == 3 && i == 1)
        x = (m[0][c] + m[1][c] + m[2][c] - 3 * '0') % 10;
      if (x > 0 && x < 10 && !preso[x]) {
        if (i == 1 && c == 0)
          return 0;
        preso[x] = 1;
        m[r][c] = '0' + x;
        if (i == 1 && c > 0)
          m[0][c - 1] = '1';
        if (aggiungi(m, r, c, n, preso) == 1)
          return 1;
        else {
          preso[x] = 0;
          m[r][c] = '_';
          if (i == 1)
            m[0][c - 1] = '0';
        }
      }
    }
    return 0;
  } else {
    int i;
    for (i = 1; i < 10; i++) {
      if (!preso[i]) {
        preso[i] = 1;
        m[r][c] = '0' + i;
        if (aggiungi(m, r, c, n, preso) == 1)
          return 1;
        else {
          preso[i] = 0;
          m[r][c] = '_';
        }
      }
    }
    return 0;
  }
}
```