user: Please show me the C implementation that matches the assembly code listed below:

```asm
<sliceedge_pack>:
  endbr64
  push   %rbx
  mov    %rdi,%rdx
  sub    $0x50,%rsp
  mov    (%rdi),%ecx
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  test   %ecx,%ecx
  je     L65
  lea    -0x1(%rcx),%eax
  mov    %eax,(%rsp)
  mov    $0x1,%eax
L65:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x10(%rsp)
  mov    0x4(%rdx),%ecx
  test   %ecx,%ecx
  je     L47
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L47:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x14(%rsp)
  mov    0x8(%rdx),%ecx
  test   %ecx,%ecx
  je     L133
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L133:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x18(%rsp)
  mov    0xc(%rdx),%ecx
  test   %ecx,%ecx
  je     L110
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L110:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x1c(%rsp)
  mov    0x10(%rdx),%ecx
  test   %ecx,%ecx
  je     L75
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L75:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x20(%rsp)
  mov    0x14(%rdx),%ecx
  test   %ecx,%ecx
  je     L57
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L57:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x24(%rsp)
  mov    0x18(%rdx),%ecx
  test   %ecx,%ecx
  je     L120
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L120:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x28(%rsp)
  mov    0x1c(%rdx),%ecx
  test   %ecx,%ecx
  je     L24
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L24:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x2c(%rsp)
  mov    0x20(%rdx),%ecx
  test   %ecx,%ecx
  je     L63
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L63:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x30(%rsp)
  mov    0x24(%rdx),%ecx
  test   %ecx,%ecx
  je     L49
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L49:
  test   %ecx,%ecx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x34(%rsp)
  mov    0x28(%rdx),%ecx
  test   %ecx,%ecx
  je     L108
  movslq %eax,%rsi
  lea    -0x1(%rcx),%edi
  add    $0x1,%eax
  mov    %edi,(%rsp,%rsi,4)
L108:
  test   %ecx,%ecx
  mov    0x2c(%rdx),%edx
  setne  %cl
  movzbl %cl,%ecx
  mov    %ecx,0x38(%rsp)
  test   %edx,%edx
  jne    L100
L55:
  xor    %eax,%eax
  test   %edx,%edx
  mov    %rsp,%rsi
  mov    $0x4,%edi
  setne  %al
  mov    %eax,0x3c(%rsp)
  xor    %eax,%eax
  call   <perm_n_pack@plt>
  lea    0x10(%rsp),%rdi
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <a_eloc_pack@plt>
  imul   $0x1ef,%ebx,%ebx
  add    %ebx,%eax
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L34
  add    $0x50,%rsp
  pop    %rbx
  ret
  nopl   0x0(%rax)
L100:
  cltq
  lea    -0x1(%rdx),%ecx
  mov    %ecx,(%rsp,%rax,4)
  jmp    L55
L34:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sliceedge_pack(array_in)
int array_in[12];
{
  int temp_arr[4], eloc_arr[12], ii, count;
  count = 0;
  for (ii = 0; ii < 12; ii++) {
    if (array_in[ii] != 0)
      temp_arr[count++] = array_in[ii] - 1;
    eloc_arr[ii] = (array_in[ii] != 0);
  }
  return perm_n_pack(4, temp_arr) * 495 + a_eloc_pack(eloc_arr);
}
```