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

```asm
<edge_hash1>:
  endbr64
  sub    $0x28,%rsp
  mov    %rdi,%rcx
  movzbl 0x2(%rdi),%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  movabs $0xb0a090806040301,%rax
  movl   $0x12100f0d,0x14(%rsp)
  mov    %rax,0xc(%rsp)
  cmp    $0x1,%dil
  je     L102
  mov    $0x1,%eax
  mov    $0x3,%edx
  jmp    L70
  nopw   0x0(%rax,%rax,1)
L214:
  movzbl 0xc(%rsp,%rax,1),%edx
L70:
  mov    %eax,%esi
  add    $0x1,%rax
  cmp    %dl,%dil
  jne    L214
  cmp    $0xb,%esi
  je     L240
  lea    0x1(%rsi),%eax
  cltq
  movzbl 0xc(%rsp,%rax,1),%edx
L336:
  movslq %esi,%rax
  mov    $0xa,%edi
  lea    0xc(%rsp,%rax,1),%rax
  sub    %esi,%edi
  add    %rax,%rdi
  jmp    L391
  nopw   0x0(%rax,%rax,1)
L229:
  movzbl 0x2(%rax),%edx
  add    $0x1,%rax
L391:
  mov    %dl,(%rax)
  cmp    %rax,%rdi
  jne    L229
  movzbl 0xc(%rsp),%r8d
  movzbl 0xd(%rsp),%eax
L27:
  movsbl 0x3(%rcx),%edx
  movzbl 0x6(%rcx),%r9d
  lea    (%rdx,%rdx,2),%edx
  lea    (%rsi,%rdx,4),%r11d
  imul   $0x1b1200,%r11d,%r11d
  cmp    %r8b,%r9b
  je     L150
  mov    %eax,%esi
  mov    $0x1,%edx
  jmp    L257
  nopl   0x0(%rax,%rax,1)
L234:
  movzbl 0xc(%rsp,%rdx,1),%esi
L257:
  mov    %edx,%edi
  add    $0x1,%rdx
  cmp    %sil,%r9b
  jne    L234
  cmp    $0x9,%edi
  jg     L179
  lea    0x1(%rdi),%eax
  cltq
  movzbl 0xc(%rsp,%rax,1),%eax
L4:
  movslq %edi,%rdx
  mov    %edi,%esi
  lea    0xc(%rsp,%rdx,1),%rdx
  sub    %edx,%esi
  jmp    L298
  nopl   (%rax)
L131:
  movzbl 0x1(%rdx),%eax
L298:
  mov    %al,(%rdx)
  add    $0x1,%rdx
  lea    (%rsi,%rdx,1),%eax
  cmp    $0x9,%eax
  jle    L131
  movzbl 0xc(%rsp),%r8d
  movzbl 0xd(%rsp),%eax
L179:
  movsbl 0x7(%rcx),%edx
  movzbl 0x8(%rcx),%r9d
  lea    (%rdx,%rdx,4),%esi
  lea    (%rdx,%rsi,2),%r10d
  add    %edi,%r10d
  imul   $0x13b00,%r10d,%r10d
  add    %r11d,%r10d
  cmp    %r8b,%r9b
  je     L5
  mov    %eax,%esi
  mov    $0x1,%edx
  jmp    L100
  nopl   0x0(%rax)
L363:
  movzbl 0xc(%rsp,%rdx,1),%esi
L100:
  mov    %edx,%edi
  add    $0x1,%rdx
  cmp    %sil,%r9b
  jne    L363
  cmp    $0x8,%edi
  jg     L18
  lea    0x1(%rdi),%eax
  cltq
  movzbl 0xc(%rsp,%rax,1),%eax
L148:
  movslq %edi,%rdx
  mov    %edi,%esi
  lea    0xc(%rsp,%rdx,1),%rdx
  sub    %edx,%esi
  jmp    L158
  nopl   (%rax)
L337:
  movzbl 0x1(%rdx),%eax
L158:
  mov    %al,(%rdx)
  add    $0x1,%rdx
  lea    (%rsi,%rdx,1),%eax
  cmp    $0x8,%eax
  jle    L337
  movzbl 0xc(%rsp),%r8d
  movzbl 0xd(%rsp),%eax
L18:
  movsbl 0x9(%rcx),%edx
  movzbl 0xc(%rcx),%r9d
  lea    (%rdx,%rdx,4),%edx
  lea    (%rdi,%rdx,2),%edx
  imul   $0xfc0,%edx,%edx
  add    %edx,%r10d
  cmp    %r8b,%r9b
  je     L82
  mov    %eax,%esi
  mov    $0x1,%edx
  jmp    L280
  nop
L268:
  movzbl 0xc(%rsp,%rdx,1),%esi
L280:
  mov    %edx,%edi
  add    $0x1,%rdx
  cmp    %sil,%r9b
  jne    L268
  cmp    $0x7,%edi
  jg     L307
  lea    0x1(%rdi),%eax
  cltq
  movzbl 0xc(%rsp,%rax,1),%eax
L48:
  movslq %edi,%rdx
  mov    %edi,%esi
  lea    0xc(%rsp,%rdx,1),%rdx
  sub    %edx,%esi
  jmp    L323
  nopl   (%rax)
L77:
  movzbl 0x1(%rdx),%eax
L323:
  mov    %al,(%rdx)
  add    $0x1,%rdx
  lea    (%rsi,%rdx,1),%eax
  cmp    $0x7,%eax
  jle    L77
  movzbl 0xc(%rsp),%r8d
  movzbl 0xd(%rsp),%eax
L307:
  movsbl 0xd(%rcx),%edx
  lea    (%rdx,%rdx,8),%r9d
  add    %edi,%r9d
  movzbl 0x10(%rcx),%edi
  imul   $0xe0,%r9d,%r9d
  add    %r10d,%r9d
  cmp    %r8b,%dil
  je     L143
  mov    $0x1,%edx
  jmp    L141
  cs nopw 0x0(%rax,%rax,1)
L33:
  movzbl 0xc(%rsp,%rdx,1),%eax
L141:
  mov    %edx,%esi
  add    $0x1,%rdx
  cmp    %al,%dil
  jne    L33
  cmp    $0x6,%esi
  jg     L395
  lea    0x1(%rsi),%eax
  cltq
  movzbl 0xc(%rsp,%rax,1),%eax
L263:
  movslq %esi,%rdx
  lea    0xc(%rsp),%rdi
  lea    0xd(%rsp),%r8
  jmp    L202
  xchg   %ax,%ax
L308:
  movzbl (%r8,%rdx,1),%eax
L202:
  mov    %al,(%rdi,%rdx,1)
  add    $0x1,%rdx
  cmp    $0x6,%edx
  jle    L308
  movzbl 0xc(%rsp),%r8d
L395:
  movsbl 0x11(%rcx),%eax
  movzbl 0x12(%rcx),%edx
  lea    (%rsi,%rax,8),%eax
  imul   $0xe,%eax,%eax
  add    %eax,%r9d
  cmp    %r8b,%dl
  je     L197
  mov    $0x1,%eax
  lea    0xb(%rsp),%rdi
  nopl   0x0(%rax,%rax,1)
L15:
  mov    %eax,%esi
  add    $0x1,%rax
  cmp    (%rdi,%rax,1),%dl
  jne    L15
L114:
  movsbl 0x13(%rcx),%edx
  lea    (%rsi,%rdx,8),%eax
  sub    %edx,%eax
  add    %r9d,%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L106
  add    $0x28,%rsp
  ret
  nopl   0x0(%rax)
L240:
  mov    $0x3,%eax
  mov    $0x1,%r8d
  jmp    L27
L150:
  xor    %edi,%edi
  jmp    L4
  nopw   0x0(%rax,%rax,1)
L5:
  xor    %edi,%edi
  jmp    L148
  nopw   0x0(%rax,%rax,1)
L82:
  xor    %edi,%edi
  jmp    L48
  nopw   0x0(%rax,%rax,1)
L143:
  xor    %esi,%esi
  jmp    L263
  nopw   0x0(%rax,%rax,1)
L197:
  xor    %esi,%esi
  jmp    L114
  nopl   0x0(%rax)
L102:
  mov    $0x3,%edx
  xor    %esi,%esi
  jmp    L336
L106:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int edge_hash1(const char *cubestr) {
  char positions[] = {1, 3, 4, 6, 8, 9, 10, 11, 13, 15, 16, 18};
  int index = 0;
  int pos, rot, num, i;
  const char *cubie;
  cubie = ((char *)cubestr + (1 << 1));
  num = cubie[0];
  pos = 0;
  while (num != positions[pos])
    ++pos;
  for (i = pos; i < 11; ++i)
    positions[i] = positions[i + 1];
  rot = cubie[1] * 12;
  index += (pos + rot) * 1774080;
  cubie = ((char *)cubestr + (3 << 1));
  num = cubie[0];
  pos = 0;
  while (num != positions[pos])
    ++pos;
  for (i = pos; i < 10; ++i)
    positions[i] = positions[i + 1];
  rot = cubie[1] * 11;
  index += (pos + rot) * 80640;
  cubie = ((char *)cubestr + (4 << 1));
  num = cubie[0];
  pos = 0;
  while (num != positions[pos])
    ++pos;
  for (i = pos; i < 9; ++i)
    positions[i] = positions[i + 1];
  rot = cubie[1] * 10;
  index += (pos + rot) * 4032;
  cubie = ((char *)cubestr + (6 << 1));
  num = cubie[0];
  pos = 0;
  while (num != positions[pos])
    ++pos;
  for (i = pos; i < 8; ++i)
    positions[i] = positions[i + 1];
  rot = cubie[1] * 9;
  index += (pos + rot) * 224;
  cubie = ((char *)cubestr + (8 << 1));
  num = cubie[0];
  pos = 0;
  while (num != positions[pos])
    ++pos;
  for (i = pos; i < 7; ++i)
    positions[i] = positions[i + 1];
  rot = cubie[1] * 8;
  index += (pos + rot) * 14;
  cubie = ((char *)cubestr + (9 << 1));
  num = cubie[0];
  pos = 0;
  while (num != positions[pos])
    ++pos;
  for (i = pos; i < 6; ++i)
    positions[i] = positions[i + 1];
  rot = cubie[1] * 7;
  index += (pos + rot);
  return index;
}
```