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

```asm
<p3dReplicatePadding3D_uchar2uchar>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x178,%rsp
  mov    %rsi,%r13
  mov    %r9d,%r15d
  lea    (%r9,%r9,1),%eax
  lea    (%rax,%rdx,1),%r14d
  lea    (%rax,%rcx,1),%ebx
  lea    (%rax,%r8,1),%ebp
  mov    $0x0,%eax
  call   <p3dZeroPadding3D_uchar2uchar@plt>
  test   %r15d,%r15d
  jle    L121
  movslq %r15d,%r10
  mov    %r10,%r11
  mov    %r14d,%edi
  sub    %r15d,%edi
  mov    %edi,0x58(%rsp)
  mov    %r14d,%eax
  neg    %eax
  imul   %ebx,%eax
  mov    %eax,0x118(%rsp)
  movslq %eax,%rsi
  mov    %r14d,%edi
  movslq %r14d,%r12
  mov    %rsi,0x10(%rsp)
  mov    %rsi,%rax
  sub    %r12,%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,0x108(%rsp)
  mov    %r14d,%edx
  imul   %r15d,%edx
  mov    %ebx,%r9d
  imul   %edx,%r9d
  movslq %r9d,%r8
  movslq %edx,%rsi
  lea    -0x1(%r14),%ecx
  mov    %ecx,0xd0(%rsp)
  movslq %ecx,%r9
  lea    (%rsi,%r9,1),%rax
  mov    %rax,%r14
  sub    %r10,%r14
  lea    (%r8,%r14,1),%rax
  mov    %rax,%r10
  add    %r13,%r10
  mov    %r10,0x60(%rsp)
  mov    %edx,%r10d
  sub    %edi,%r10d
  mov    %r10d,%ecx
  mov    %ebx,%r10d
  imul   %ecx,%r10d
  mov    %r10d,%eax
  movslq %ecx,%r10
  mov    %r12,%rcx
  mov    %r11,0x40(%rsp)
  sub    %r11,%rcx
  lea    (%rcx,%r10,1),%r11
  movslq %eax,%rcx
  mov    %r11,0x18(%rsp)
  add    %r11,%rcx
  add    %r13,%rcx
  mov    %rcx,0x70(%rsp)
  mov    %eax,0x7c(%rsp)
  mov    %r12,0x68(%rsp)
  lea    -0x1(%r12),%r11
  mov    0x10(%rsp),%rax
  lea    (%r11,%rax,1),%r12
  mov    %r12,0x110(%rsp)
  lea    -0x1(%rbx),%eax
  sub    %r15d,%eax
  mov    %edi,%ecx
  imul   %edi,%eax
  movslq %eax,%r12
  mov    0x40(%rsp),%rax
  add    %r8,%rax
  add    %r12,%rax
  mov    %r13,0x8(%rsp)
  add    %r13,%rax
  mov    %rax,0x80(%rsp)
  not    %ecx
  mov    %ecx,0x11c(%rsp)
  movslq %ecx,%r13
  mov    %edi,%ecx
  mov    %edi,%eax
  imul   %ebx,%eax
  mov    %eax,0x104(%rsp)
  movslq %eax,%rdi
  mov    %r13,0x30(%rsp)
  lea    0x0(%r13,%rdi,1),%rax
  mov    %rax,0x120(%rsp)
  lea    -0x1(%rbp),%eax
  sub    %r15d,%eax
  mov    %ecx,0x24(%rsp)
  imul   %ecx,%eax
  imul   %ebx,%eax
  movslq %eax,%r13
  add    0x40(%rsp),%rsi
  mov    %rsi,0x38(%rsp)
  lea    (%rsi,%r13,1),%rax
  add    0x8(%rsp),%rax
  mov    %rax,0x88(%rsp)
  sub    %r15d,%ebp
  mov    %ebp,%ecx
  mov    0x24(%rsp),%eax
  imul   %ebp,%eax
  mov    %eax,%ebp
  imul   %ebx,%ebp
  mov    %ebp,%esi
  movslq %ebp,%rbp
  mov    0x40(%rsp),%rax
  lea    -0x1(%rax,%r10,1),%rax
  add    %rbp,%rax
  mov    %rax,%r10
  add    0x8(%rsp),%r10
  mov    %r10,0x90(%rsp)
  mov    0x68(%rsp),%rax
  lea    0x1(%rax),%r10
  mov    0x10(%rsp),%rax
  add    %r10,%rax
  mov    %rax,0x128(%rsp)
  sub    0x40(%rsp),%r9
  lea    (%r8,%r9,1),%rax
  add    %r12,%rax
  add    0x8(%rsp),%rax
  mov    %rax,0x98(%rsp)
  mov    %esi,0xc0(%rsp)
  lea    (%r11,%rdi,1),%rax
  mov    %rax,0x130(%rsp)
  mov    0x40(%rsp),%rax
  add    %r12,%rax
  add    %r13,%rax
  mov    0x8(%rsp),%r11
  add    %r11,%rax
  mov    %rax,0xa0(%rsp)
  mov    %rdi,%rax
  sub    0x68(%rsp),%rax
  add    $0x1,%rax
  mov    %rax,0x138(%rsp)
  lea    (%r14,%r13,1),%rax
  mov    %rax,%r14
  add    %r11,%r14
  mov    %r14,0xa8(%rsp)
  mov    0x18(%rsp),%r14
  lea    (%r14,%rbp,1),%rax
  mov    %rax,%rbp
  add    %r11,%rbp
  mov    %rbp,0xb0(%rsp)
  add    %rdi,%r10
  mov    %r10,0x140(%rsp)
  lea    (%r12,%r9,1),%rax
  add    %r13,%rax
  mov    %rax,%r9
  add    %r11,%r9
  mov    %r9,0xb8(%rsp)
  mov    %ecx,0x18(%rsp)
  mov    %ebx,%ebp
  sub    %r15d,%ebp
  mov    %ebp,0xc4(%rsp)
  mov    0x24(%rsp),%r9d
  lea    0x1(%r9),%r12d
  mov    %r12d,%r13d
  mov    %r12d,0x148(%rsp)
  imul   %r15d,%r12d
  mov    %r12d,0x5c(%rsp)
  mov    $0x1,%eax
  mov    %eax,%r10d
  sub    %r9d,%r10d
  mov    %r10d,0x14c(%rsp)
  mov    %edx,0x20(%rsp)
  mov    0x58(%rsp),%r14d
  lea    (%r14,%rdx,1),%r10d
  mov    %r10d,0xd4(%rsp)
  mov    0x104(%rsp),%eax
  mov    %eax,%r10d
  imul   %r15d,%r10d
  mov    %r10d,0x48(%rsp)
  lea    -0x1(%r15),%esi
  mov    %eax,%r10d
  imul   %esi,%eax
  mov    %eax,0x4c(%rsp)
  lea    -0x1(%rcx),%eax
  imul   %r10d,%eax
  mov    %eax,0x50(%rsp)
  imul   %r10d,%ecx
  mov    %ecx,0x54(%rsp)
  mov    %r9d,%r10d
  imul   %esi,%r9d
  mov    %r9d,0x28(%rsp)
  lea    -0x1(%rbp),%eax
  mov    %eax,%ecx
  imul   %r10d,%ecx
  mov    %ecx,0x2c(%rsp)
  imul   %r10d,%ebp
  mov    %ebp,0x78(%rsp)
  mov    %r13d,%r10d
  imul   %esi,%r10d
  mov    %r10d,0xdc(%rsp)
  lea    -0x1(%r14),%eax
  add    %eax,%edx
  mov    %edx,0xe0(%rsp)
  mov    %r14d,%r10d
  mov    %r9d,%edx
  add    %r9d,%r10d
  mov    %r10d,0xe4(%rsp)
  lea    (%r15,%rcx,1),%r9d
  mov    %r9d,0xe8(%rsp)
  mov    %esi,%r9d
  add    %ebp,%r9d
  mov    %r9d,0xec(%rsp)
  mov    %eax,%r9d
  add    %ecx,%r9d
  mov    %r9d,0xf0(%rsp)
  add    %ebp,%r14d
  mov    %r14d,0xf4(%rsp)
  mov    0x10(%rsp),%rsi
  add    0x30(%rsp),%rsi
  mov    %rsi,0x150(%rsp)
  mov    0x38(%rsp),%rsi
  lea    (%rsi,%r8,1),%rax
  mov    %rax,%rsi
  add    %r11,%rsi
  mov    %rsi,0x158(%rsp)
  mov    %edx,%esi
  movslq %edx,%rax
  mov    0x40(%rsp),%rdx
  add    %rax,%rdx
  mov    %ebx,%eax
  imul   %esi,%eax
  cltq
  add    %rdx,%rax
  add    %r11,%rax
  mov    %rax,0x160(%rsp)
  mov    %r12d,0xd8(%rsp)
  movq   $0x0,0xc8(%rsp)
  movslq 0xd0(%rsp),%rax
  mov    %rax,0x168(%rsp)
  mov    0x18(%rsp),%r13d
  mov    %r15d,%r12d
  mov    %rdi,%r15
  jmp    L100
L116:
  mov    %r11,0x10(%rsp)
L178:
  mov    %rax,%rdx
  sub    %rdi,%rdx
  movzbl (%rax),%r11d
  mov    %r11b,(%rdx,%r10,1)
  movzbl (%rdx,%r9,1),%r11d
  mov    %r11b,(%rdx,%r8,1)
  add    $0x1,%ecx
  add    %rbp,%rax
  cmp    %esi,%ecx
  jne    L178
  mov    0x10(%rsp),%r11
L71:
  add    $0x1,%ebx
  add    $0x1,%r11
  cmp    %r14d,%ebx
  je     L221
L220:
  mov    %esi,0x18(%rsp)
  mov    %r11,%rax
  mov    %r12d,%ecx
  cmp    %r13d,%r12d
  jl     L116
  jmp    L71
L188:
  mov    0xc4(%rsp),%eax
  mov    %eax,0x18(%rsp)
  cmp    %r12d,%eax
  jg     L231
  jmp    L172
L164:
  lea    -0x1(%r11),%edi
  mov    0x30(%rsp),%eax
  lea    (%rax,%rbx,1),%esi
  movslq %r11d,%r8
  mov    0x38(%rsp),%rax
  add    %r8,%rax
  add    0x8(%rsp),%rax
  mov    %r12d,%ecx
  movslq %edi,%rdi
  movslq %esi,%rsi
  movslq %ebx,%r9
  mov    %r11d,0x10(%rsp)
L50:
  mov    %rax,%rdx
  sub    %r8,%rdx
  movzbl (%rax),%r11d
  mov    %r11b,(%rdx,%rdi,1)
  movzbl (%rdx,%rsi,1),%r11d
  mov    %r11b,(%rdx,%r9,1)
  add    $0x1,%ecx
  add    %r15,%rax
  cmp    %r10d,%ecx
  jne    L50
  mov    0x10(%rsp),%r11d
L77:
  add    $0x1,%ebp
  mov    0x24(%rsp),%eax
  add    %eax,%r11d
  add    %eax,%ebx
  cmp    %r14d,%ebp
  jge    L194
L94:
  cmp    %r13d,%r12d
  jl     L164
  jmp    L77
L194:
  mov    0xf8(%rsp),%r14d
  cmp    %r12d,%r14d
  jle    L172
L35:
  mov    %r12d,%r11d
  mov    %r13d,%r10d
  movslq 0x48(%rsp),%rbx
  mov    0x78(%rsp),%ebp
  jmp    L2
L32:
  mov    0x28(%rsp),%eax
  lea    (%r11,%rax,1),%r9d
  mov    0x2c(%rsp),%eax
  lea    (%r11,%rax,1),%r8d
  lea    (%r11,%rbp,1),%edi
  mov    0x20(%rsp),%eax
  lea    (%r11,%rax,1),%esi
  movslq %esi,%rsi
  lea    (%rbx,%rsi,1),%rax
  add    0x8(%rsp),%rax
  mov    %r12d,%ecx
  movslq %r9d,%r9
  movslq %r8d,%r8
  movslq %edi,%rdi
  mov    %r11d,0x10(%rsp)
L92:
  mov    %rax,%rdx
  sub    %rsi,%rdx
  movzbl (%rax),%r11d
  mov    %r11b,(%rdx,%r9,1)
  movzbl (%rdx,%r8,1),%r11d
  mov    %r11b,(%rdx,%rdi,1)
  add    $0x1,%ecx
  add    %r15,%rax
  cmp    %r10d,%ecx
  jne    L92
  mov    0x10(%rsp),%r11d
L176:
  add    $0x1,%r11d
  cmp    %r14d,%r11d
  jge    L189
L2:
  cmp    %r13d,%r12d
  jl     L32
  jmp    L176
L189:
  mov    0x54(%rsp),%ebp
  mov    0x78(%rsp),%ebx
  mov    0x40(%rsp),%rax
  movslq 0x48(%rsp),%rdi
  mov    %rdi,0x10(%rsp)
  movslq 0x20(%rsp),%rcx
  lea    (%rdi,%rcx,1),%r11
  mov    0x8(%rsp),%rdi
  add    %rdi,%r11
  movslq 0x4c(%rsp),%rsi
  movslq 0x28(%rsp),%rdx
  mov    %rsi,%r10
  mov    %rdx,0x38(%rsp)
  add    %rdx,%r10
  add    %rdi,%r10
  movslq 0x50(%rsp),%rdx
  add    %rdx,%rcx
  lea    (%rdi,%rcx,1),%r9
  movslq 0x2c(%rsp),%rcx
  mov    %rcx,0x30(%rsp)
  add    %rcx,%rdx
  lea    (%rdi,%rdx,1),%r8
  mov    %r15,0xf8(%rsp)
  mov    0x38(%rsp),%r15
  mov    %r13d,0x38(%rsp)
  mov    %rsi,%r13
  mov    %r12d,0x100(%rsp)
  mov    %rdi,%r12
L122:
  movzbl (%r11,%rax,1),%edx
  mov    %dl,(%r10,%rax,1)
  movzbl (%r9,%rax,1),%esi
  movslq %ebp,%rdx
  lea    (%r15,%rdx,1),%rcx
  add    %r12,%rcx
  mov    %sil,(%rcx,%rax,1)
  mov    0x10(%rsp),%rcx
  add    0x30(%rsp),%rcx
  add    %r12,%rcx
  movzbl (%rcx,%rax,1),%edi
  movslq %ebx,%rsi
  lea    0x0(%r13,%rsi,1),%rcx
  add    %r12,%rcx
  mov    %dil,(%rcx,%rax,1)
  movzbl (%r8,%rax,1),%ecx
  add    %rsi,%rdx
  add    %r12,%rdx
  mov    %cl,(%rdx,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%r14d
  jg     L122
  mov    0xf8(%rsp),%r15
  mov    0x38(%rsp),%r13d
  mov    0x100(%rsp),%r12d
L172:
  mov    0x18(%rsp),%r11d
  cmp    %r12d,%r11d
  jle    L125
  movslq 0x20(%rsp),%rdi
  movslq 0x50(%rsp),%rbx
  lea    (%rdi,%rbx,1),%rsi
  mov    0x40(%rsp),%r8
  add    %r8,%rsi
  mov    0x8(%rsp),%r9
  add    %r9,%rsi
  movslq 0x54(%rsp),%rbp
  lea    (%rdi,%rbp,1),%rcx
  lea    -0x1(%r12),%edx
  movslq %edx,%rdx
  add    %rcx,%rdx
  add    %r9,%rdx
  mov    0x168(%rsp),%rax
  sub    %r8,%rax
  add    %rdi,%rax
  add    %rbx,%rax
  add    %r9,%rax
  mov    0x68(%rsp),%r10
  mov    %r10,%rdi
  sub    %r8,%rdi
  add    %rdi,%rcx
  add    %r9,%rcx
  mov    %r12d,%edi
  movslq 0x48(%rsp),%r9
  movslq 0x4c(%rsp),%r8
  mov    %r13d,0x10(%rsp)
  mov    %r10,%r13
  mov    %r12d,0x30(%rsp)
  mov    %rbx,%r12
  mov    %r11d,%ebx
L147:
  mov    %rsi,%r10
  sub    %r12,%r10
  movzbl (%r10,%r9,1),%r11d
  mov    %rdx,%r10
  sub    %rbp,%r10
  mov    %r11b,(%r10,%r8,1)
  movzbl (%rsi),%r10d
  mov    %r10b,(%rdx)
  mov    %rax,%r10
  sub    %r12,%r10
  movzbl (%r10,%r9,1),%r11d
  mov    %rcx,%r10
  sub    %rbp,%r10
  mov    %r11b,(%r10,%r8,1)
  movzbl (%rax),%r10d
  mov    %r10b,(%rcx)
  add    $0x1,%edi
  add    %r13,%rsi
  add    %r13,%rdx
  add    %r13,%rax
  add    %r13,%rcx
  cmp    %ebx,%edi
  jne    L147
  mov    0x10(%rsp),%r13d
  mov    0x30(%rsp),%r12d
L125:
  mov    %r13d,%esi
  cmp    %r13d,%r12d
  jge    L40
  movslq 0xd8(%rsp),%rax
  mov    %rax,0x10(%rsp)
  movslq 0x48(%rsp),%rdx
  add    %rax,%rdx
  add    0x8(%rsp),%rdx
  mov    %r12d,%ecx
  movslq 0xdc(%rsp),%rbp
  movslq 0xe0(%rsp),%rbx
  movslq 0xe4(%rsp),%r11
  movslq 0xe8(%rsp),%r10
  movslq 0xec(%rsp),%r9
  movslq 0xf0(%rsp),%r8
  movslq 0xf4(%rsp),%rdi
  mov    %r12d,0x30(%rsp)
L59:
  mov    %rdx,%rax
  sub    0x10(%rsp),%rax
  movzbl (%rdx),%r12d
  mov    %r12b,(%rax,%rbp,1)
  movzbl (%rax,%rbx,1),%r12d
  mov    %r12b,(%rax,%r11,1)
  movzbl (%rax,%r10,1),%r12d
  mov    %r12b,(%rax,%r9,1)
  movzbl (%rax,%r8,1),%r12d
  mov    %r12b,(%rax,%rdi,1)
  add    $0x1,%ecx
  add    %r15,%rdx
  cmp    %esi,%ecx
  jne    L59
  mov    0x30(%rsp),%r12d
L40:
  sub    $0x1,%r12d
  mov    0x158(%rsp),%rax
  mov    0xc8(%rsp),%r9
  movzbl (%rax,%r9,1),%eax
  mov    0x160(%rsp),%rbx
  mov    %al,-0x1(%rbx,%r9,1)
  mov    0x60(%rsp),%r10
  movzbl (%r10),%eax
  mov    0x70(%rsp),%r11
  mov    %al,(%r11)
  mov    0x18(%rsp),%eax
  mov    0x24(%rsp),%ebx
  imul   %ebx,%eax
  lea    (%r12,%rax,1),%edx
  mov    0x80(%rsp),%rbp
  movzbl 0x0(%rbp),%esi
  mov    0x7c(%rsp),%edi
  lea    (%rdi,%rdx,1),%ecx
  movslq %ecx,%rcx
  mov    0x8(%rsp),%r8
  mov    %sil,(%r8,%rcx,1)
  mov    0x88(%rsp),%rsi
  movzbl (%rsi),%ecx
  mov    0x90(%rsp),%rsi
  mov    %cl,(%rsi)
  add    %r14d,%eax
  mov    0x98(%rsp),%r14
  movzbl (%r14),%esi
  lea    (%rdi,%rax,1),%ecx
  movslq %ecx,%rcx
  mov    %sil,(%r8,%rcx,1)
  mov    0xa0(%rsp),%rcx
  movzbl (%rcx),%ecx
  mov    0xc0(%rsp),%esi
  add    %esi,%edx
  movslq %edx,%rdx
  mov    %cl,(%r8,%rdx,1)
  mov    0xa8(%rsp),%rdx
  movzbl (%rdx),%edx
  mov    0xb0(%rsp),%rcx
  mov    %dl,(%rcx)
  mov    0xb8(%rsp),%rcx
  movzbl (%rcx),%edx
  add    %esi,%eax
  cltq
  mov    %dl,(%r8,%rax,1)
  subq   $0x1,0x40(%rsp)
  addl   $0x1,0x58(%rsp)
  mov    0x108(%rsp),%r8
  add    %r8,%r10
  mov    %r10,0x60(%rsp)
  add    %r8,%r11
  mov    %r11,0x70(%rsp)
  mov    0x118(%rsp),%r8d
  add    %r8d,%edi
  mov    %edi,0x7c(%rsp)
  mov    0x110(%rsp),%rdi
  add    %rdi,%rbp
  mov    %rbp,0x80(%rsp)
  mov    0x120(%rsp),%rdi
  add    %rdi,0x88(%rsp)
  add    %rdi,0x90(%rsp)
  mov    0x128(%rsp),%rdi
  add    %rdi,%r14
  mov    %r14,0x98(%rsp)
  mov    0x104(%rsp),%edi
  add    %edi,%esi
  mov    %esi,0xc0(%rsp)
  mov    0x130(%rsp),%rsi
  add    %rsi,0xa0(%rsp)
  mov    0x138(%rsp),%rsi
  add    %rsi,0xa8(%rsp)
  add    %rsi,0xb0(%rsp)
  mov    0x140(%rsp),%rax
  add    %rax,%rcx
  mov    %rcx,0xb8(%rsp)
  add    $0x1,%r13d
  addl   $0x1,0xc4(%rsp)
  mov    0x5c(%rsp),%eax
  sub    %ebx,%eax
  sub    $0x1,%eax
  mov    %eax,0x5c(%rsp)
  mov    0x14c(%rsp),%eax
  add    %eax,0xd4(%rsp)
  sub    %ebx,0x20(%rsp)
  sub    %edi,0x48(%rsp)
  sub    %edi,0x4c(%rsp)
  add    %edi,0x50(%rsp)
  add    %edi,0x54(%rsp)
  sub    %ebx,0x28(%rsp)
  add    %ebx,0x2c(%rsp)
  add    %ebx,0x78(%rsp)
  mov    0x11c(%rsp),%edi
  add    %edi,0xd8(%rsp)
  add    %edi,0xdc(%rsp)
  add    %eax,0xe0(%rsp)
  add    %eax,0xe4(%rsp)
  mov    0xd0(%rsp),%ebx
  add    %ebx,0xe8(%rsp)
  add    %ebx,0xec(%rsp)
  mov    0x148(%rsp),%ebx
  add    %ebx,0xf0(%rsp)
  add    %ebx,0xf4(%rsp)
  mov    0x150(%rsp),%rax
  add    %rax,%r9
  mov    %r9,0xc8(%rsp)
  test   %r12d,%r12d
  je     L121
L100:
  mov    0x58(%rsp),%eax
  mov    %eax,%r14d
  cmp    %r12d,%eax
  jle    L188
  movslq 0x48(%rsp),%rdi
  movslq 0x20(%rsp),%r11
  add    %rdi,%r11
  add    0x40(%rsp),%r11
  add    0x8(%rsp),%r11
  mov    %r12d,%ebx
  mov    0xc4(%rsp),%eax
  mov    %eax,%esi
  movslq 0x4c(%rsp),%r10
  movslq 0x50(%rsp),%r9
  movslq 0x54(%rsp),%r8
  mov    0x68(%rsp),%rbp
  mov    %r13d,0x30(%rsp)
  mov    %eax,%r13d
  jmp    L220
L221:
  mov    0x30(%rsp),%r13d
  cmp    0x18(%rsp),%r12d
  jge    L35
L231:
  mov    0xd4(%rsp),%ebx
  mov    0x5c(%rsp),%r11d
  mov    %r12d,%ebp
  mov    %r13d,%r10d
  mov    0xd0(%rsp),%eax
  sub    %r12d,%eax
  sub    0x58(%rsp),%eax
  mov    %eax,0x30(%rsp)
  movslq 0x48(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mov    %r14d,0xf8(%rsp)
  mov    0x18(%rsp),%r14d
  jmp    L94
L121:
  mov    $0x2,%eax
  add    $0x178,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int p3dReplicatePadding3D_uchar2uchar(unsigned char *in_rev, unsigned char *out_rev, const int dimx, const int dimy, const int dimz, const int size) {
  int a_dimx, a_dimy, a_dimz;
  int i, j, k, ct;
  a_dimx = dimx + size * 2;
  a_dimy = dimy + size * 2;
  a_dimz = dimz + size * 2;
  p3dZeroPadding3D_uchar2uchar(in_rev, out_rev, dimx, dimy, dimz, size);
  for (ct = size; ct > 0; ct--) {
    for (i = ct; i < (a_dimx - ct); i++)
      for (j = ct; j < (a_dimy - ct); j++) {
        out_rev[((j) * (a_dimx) + (i) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (i) + (ct) * (a_dimx) * (a_dimy))];
        out_rev[((j) * (a_dimx) + (i) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (i) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
      }
    for (j = ct; j < (a_dimy - ct); j++)
      for (k = ct; k < (a_dimz - ct); k++) {
        out_rev[((j) * (a_dimx) + (ct - 1) + (k) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (ct) + (k) * (a_dimx) * (a_dimy))];
        out_rev[((j) * (a_dimx) + (a_dimx - ct) + (k) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (a_dimx - 1 - ct) + (k) * (a_dimx) * (a_dimy))];
      }
    for (i = ct; i < (a_dimx - ct); i++)
      for (k = ct; k < (a_dimz - ct); k++) {
        out_rev[((ct - 1) * (a_dimx) + (i) + (k) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (i) + (k) * (a_dimx) * (a_dimy))];
        out_rev[((a_dimy - ct) * (a_dimx) + (i) + (k) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (i) + (k) * (a_dimx) * (a_dimy))];
      }
    for (i = ct; i < (a_dimx - ct); i++) {
      out_rev[((ct - 1) * (a_dimx) + (i) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (i) + (ct) * (a_dimx) * (a_dimy))];
      out_rev[((ct - 1) * (a_dimx) + (i) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (i) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
      out_rev[((a_dimy - ct) * (a_dimx) + (i) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (i) + (ct) * (a_dimx) * (a_dimy))];
      out_rev[((a_dimy - ct) * (a_dimx) + (i) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (i) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
    }
    for (j = ct; j < (a_dimy - ct); j++) {
      out_rev[((j) * (a_dimx) + (ct - 1) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (ct) + (ct) * (a_dimx) * (a_dimy))];
      out_rev[((j) * (a_dimx) + (ct - 1) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (ct) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
      out_rev[((j) * (a_dimx) + (a_dimx - ct) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (a_dimx - 1 - ct) + (ct) * (a_dimx) * (a_dimy))];
      out_rev[((j) * (a_dimx) + (a_dimx - ct) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((j) * (a_dimx) + (a_dimx - 1 - ct) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
    }
    for (k = ct; k < (a_dimz - ct); k++) {
      out_rev[((ct - 1) * (a_dimx) + (ct - 1) + (k) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (ct) + (k) * (a_dimx) * (a_dimy))];
      out_rev[((ct - 1) * (a_dimx) + (a_dimx - ct) + (k) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (a_dimx - 1 - ct) + (k) * (a_dimx) * (a_dimy))];
      out_rev[((a_dimy - ct) * (a_dimx) + (ct - 1) + (k) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (ct) + (k) * (a_dimx) * (a_dimy))];
      out_rev[((a_dimy - ct) * (a_dimx) + (a_dimx - ct) + (k) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (a_dimx - 1 - ct) + (k) * (a_dimx) * (a_dimy))];
    }
    out_rev[((ct - 1) * (a_dimx) + (ct - 1) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (ct) + (ct) * (a_dimx) * (a_dimy))];
    out_rev[((ct - 1) * (a_dimx) + (a_dimx - ct) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (a_dimx - 1 - ct) + (ct) * (a_dimx) * (a_dimy))];
    out_rev[((a_dimy - ct) * (a_dimx) + (ct - 1) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (ct) + (ct) * (a_dimx) * (a_dimy))];
    out_rev[((ct - 1) * (a_dimx) + (ct - 1) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (ct) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
    out_rev[((a_dimy - ct) * (a_dimx) + (a_dimx - ct) + (ct - 1) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (a_dimx - 1 - ct) + (ct) * (a_dimx) * (a_dimy))];
    out_rev[((a_dimy - ct) * (a_dimx) + (ct - 1) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (ct) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
    out_rev[((ct - 1) * (a_dimx) + (a_dimx - ct) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((ct) * (a_dimx) + (a_dimx - 1 - ct) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
    out_rev[((a_dimy - ct) * (a_dimx) + (a_dimx - ct) + (a_dimz - ct) * (a_dimx) * (a_dimy))] = out_rev[((a_dimy - 1 - ct) * (a_dimx) + (a_dimx - 1 - ct) + (a_dimz - 1 - ct) * (a_dimx) * (a_dimy))];
  }
  return 2;
}
```