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

```asm
<isHappy>:
  endbr64
  sub    $0x38,%rsp
  mov    %edi,%eax
  mov    $0xa,%ecx
  mov    %fs:0x28,%rdx
  mov    %rdx,0x28(%rsp)
  xor    %edx,%edx
  mov    %rsp,%rsi
  jmp    L82
  nopw   0x0(%rax,%rax,1)
L235:
  movslq %edx,%rax
  mov    %edx,%edi
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edi
  sar    $0x22,%rax
  sub    %edi,%eax
  lea    (%rax,%rax,4),%edi
  add    %edi,%edi
  sub    %edi,%edx
  mov    %edx,0x4(%rsp)
  test   %eax,%eax
  je     L124
  movslq %eax,%rdx
  mov    %eax,%edi
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%edi
  sar    $0x22,%rdx
  sub    %edi,%edx
  lea    (%rdx,%rdx,4),%edi
  add    %edi,%edi
  sub    %edi,%eax
  mov    %eax,0x8(%rsp)
  test   %edx,%edx
  je     L5
  movslq %edx,%rax
  mov    %edx,%edi
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edi
  sar    $0x22,%rax
  sub    %edi,%eax
  lea    (%rax,%rax,4),%edi
  add    %edi,%edi
  sub    %edi,%edx
  mov    %edx,0xc(%rsp)
  test   %eax,%eax
  je     L184
  movslq %eax,%rdx
  mov    %eax,%edi
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%edi
  sar    $0x22,%rdx
  sub    %edi,%edx
  lea    (%rdx,%rdx,4),%edi
  add    %edi,%edi
  sub    %edi,%eax
  mov    %eax,0x10(%rsp)
  test   %edx,%edx
  je     L218
  movslq %edx,%rax
  mov    %edx,%edi
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edi
  sar    $0x22,%rax
  sub    %edi,%eax
  lea    (%rax,%rax,4),%edi
  add    %edi,%edi
  sub    %edi,%edx
  mov    %edx,0x14(%rsp)
  test   %eax,%eax
  je     L237
  movslq %eax,%rdx
  mov    %eax,%edi
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%edi
  sar    $0x22,%rdx
  sub    %edi,%edx
  lea    (%rdx,%rdx,4),%edi
  add    %edi,%edi
  sub    %edi,%eax
  mov    %eax,0x18(%rsp)
  test   %edx,%edx
  je     L176
  movslq %edx,%rax
  mov    %edx,%edi
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edi
  sar    $0x22,%rax
  sub    %edi,%eax
  lea    (%rax,%rax,4),%edi
  add    %edi,%edi
  sub    %edi,%edx
  mov    %edx,0x1c(%rsp)
  test   %eax,%eax
  je     L17
  movslq %eax,%rdx
  mov    %eax,%edi
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%edi
  sar    $0x22,%rdx
  sub    %edi,%edx
  lea    (%rdx,%rdx,4),%edi
  add    %edi,%edi
  sub    %edi,%eax
  mov    %eax,0x20(%rsp)
  test   %edx,%edx
  je     L239
  mov    %edx,0x24(%rsp)
  mov    $0xa,%r8d
L277:
  movslq %r8d,%rax
  mov    %r8d,%edi
  lea    -0x10(%rsi,%rax,4),%rax
  shr    $0x2,%edi
  movdqu -0x10(%rax),%xmm2
  movdqu (%rax),%xmm3
  pshufd $0x1b,%xmm2,%xmm2
  pshufd $0x1b,%xmm3,%xmm1
  movdqa %xmm2,%xmm0
  pmuludq %xmm2,%xmm0
  psrlq  $0x20,%xmm2
  pmuludq %xmm2,%xmm2
  pshufd $0x8,%xmm0,%xmm0
  pshufd $0x8,%xmm2,%xmm2
  punpckldq %xmm2,%xmm0
  movdqa %xmm1,%xmm2
  pmuludq %xmm1,%xmm2
  psrlq  $0x20,%xmm1
  pmuludq %xmm1,%xmm1
  pshufd $0x8,%xmm2,%xmm2
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm2
  paddd  %xmm2,%xmm0
L242:
  movdqa %xmm0,%xmm1
  shl    $0x2,%edi
  mov    %r8d,%edx
  psrldq $0x8,%xmm1
  sub    %edi,%edx
  paddd  %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  psrldq $0x4,%xmm1
  paddd  %xmm1,%xmm0
  movd   %xmm0,%eax
  cmp    %r8d,%edi
  je     L116
L33:
  lea    -0x1(%rdx),%r8d
  movslq %r8d,%rdi
  mov    (%rsp,%rdi,4),%edi
  imul   %edi,%edi
  add    %edi,%eax
  test   %r8d,%r8d
  je     L116
  lea    -0x2(%rdx),%r8d
  movslq %r8d,%rdi
  mov    (%rsp,%rdi,4),%edi
  imul   %edi,%edi
  add    %edi,%eax
  test   %r8d,%r8d
  je     L116
  sub    $0x3,%edx
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%edx
  imul   %edx,%edx
  add    %edx,%eax
L116:
  cmp    $0x1,%eax
  je     L78
  sub    $0x1,%ecx
  je     L89
L82:
  test   %eax,%eax
  je     L229
  movslq %eax,%rdx
  mov    %eax,%edi
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%edi
  sar    $0x22,%rdx
  sub    %edi,%edx
  lea    (%rdx,%rdx,4),%edi
  add    %edi,%edi
  sub    %edi,%eax
  mov    %eax,(%rsp)
  test   %edx,%edx
  jne    L235
  mov    $0x1,%edx
  xor    %eax,%eax
  jmp    L33
L229:
  cmp    $0x1,%ecx
  je     L89
  sub    $0x2,%ecx
  jne    L229
  nopw   0x0(%rax,%rax,1)
L89:
  xor    %eax,%eax
L247:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L181
  add    $0x38,%rsp
  ret
L124:
  mov    $0x2,%edx
  xor    %eax,%eax
  jmp    L33
L5:
  mov    $0x3,%edx
  xor    %eax,%eax
  jmp    L33
L184:
  mov    $0x4,%r8d
L87:
  movslq %r8d,%rax
  mov    %r8d,%edi
  movdqu -0x10(%rsp,%rax,4),%xmm1
  shr    $0x2,%edi
  pshufd $0x1b,%xmm1,%xmm1
  movdqa %xmm1,%xmm0
  pmuludq %xmm1,%xmm0
  psrlq  $0x20,%xmm1
  pmuludq %xmm1,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm0
  jmp    L242
L218:
  mov    $0x5,%r8d
  jmp    L87
L78:
  mov    $0x1,%eax
  jmp    L247
L237:
  mov    $0x6,%r8d
  jmp    L87
L176:
  mov    $0x7,%r8d
  jmp    L87
L17:
  mov    $0x8,%r8d
  jmp    L277
L239:
  mov    $0x9,%r8d
  jmp    L277
L181:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
bool isHappy(int n) {
  int len = 0;
  int a[10];
  int sum = n;
  for (int i = 0; i < 10; i++) {
    while (sum) {
      a[len++] = sum % 10;
      sum /= 10;
    }
    sum = 0;
    while (len) {
      len--;
      sum += a[len] * a[len];
    }
    if (sum == 1) {
      return true;
    }
  }
  return false;
}
```