#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int get_pkcs_padding(unsigned char *input, unsigned int input_len,
                     size_t *data_len) {
  unsigned int i, pad_idx;
  unsigned char padding_len, bad = 0;
  if (NULL == input || NULL == data_len)
    return -0x6100;
  padding_len = input[input_len - 1];
  *data_len = input_len - padding_len;
  bad |= padding_len > input_len;
  bad |= padding_len == 0;
  pad_idx = input_len - padding_len;
  for (i = 0; i < input_len; i++)
    bad |= (input[i] ^ padding_len) * (i >= pad_idx);
  return -0x6200 * (bad != 0);
}


x86 assembly (clang, -O0):
<get_pkcs_padding>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movb   $0x0,-0x2a(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     112b <get_pkcs_padding+0x2b>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1137 <get_pkcs_padding+0x37>
movl   $0xffff9f00,-0x4(%rbp)
jmp    11fd <get_pkcs_padding+0xfd>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
mov    -0x14(%rbp),%eax
movzbl -0x29(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movzbl -0x29(%rbp),%eax
cmp    -0x14(%rbp),%eax
seta   %al
and    $0x1,%al
movzbl %al,%ecx
movzbl -0x2a(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x2a(%rbp)
movzbl -0x29(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%ecx
movzbl -0x2a(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x2a(%rbp)
mov    -0x14(%rbp),%eax
movzbl -0x29(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    11e5 <get_pkcs_padding+0xe5>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
movzbl (%rax,%rcx,1),%ecx
movzbl -0x29(%rbp),%eax
xor    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%eax
imul   %eax,%ecx
movzbl -0x2a(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x2a(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a0 <get_pkcs_padding+0xa0>
movzbl -0x2a(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
imul   $0xffff9e00,%eax,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pkcs_padding>:
mov    $0xffff9f00,%eax
test   %rdi,%rdi
je     1e7d <get_pkcs_padding+0xd7d>
test   %rdx,%rdx
je     1e7d <get_pkcs_padding+0xd7d>
push   %rbx
sub    $0x10,%rsp
lea    -0x1(%rsi),%eax
movzbl (%rdi,%rax,1),%r11d
test   %r11d,%r11d
sete   %cl
mov    %esi,%ebx
sub    %r11d,%ebx
setb   %al
or     %cl,%al
mov    %rbx,(%rdx)
cmp    $0x1,%esi
jb     1e6c <get_pkcs_padding+0xd6c>
mov    %esi,%r10d
xor    %r8d,%r8d
cmp    $0x20,%esi
jae    1152 <get_pkcs_padding+0x52>
xor    %esi,%esi
jmp    1e50 <get_pkcs_padding+0xd50>
mov    %r10d,%esi
and    $0xffffffe0,%esi
movzbl %al,%eax
movd   %eax,%xmm1
movzbl %r11b,%eax
movd   %eax,%xmm0
punpcklbw %xmm0,%xmm0
pshuflw $0x0,%xmm0,%xmm0
pshufd $0x0,%xmm0,%xmm2
movq   %rbx,%xmm0
pshufd $0x44,%xmm0,%xmm12
lea    -0x20(%rsi),%rax
mov    %rax,%r9
shr    $0x5,%r9
add    $0x1,%r9
test   %rax,%rax
je     1e7e <get_pkcs_padding+0xd7e>
mov    %r9,%rax
and    $0xfffffffffffffffe,%rax
movdqa 0xe58(%rip),%xmm10
movdqa 0xe60(%rip),%xmm3
movdqa 0xe68(%rip),%xmm6
movdqa 0xe70(%rip),%xmm4
movdqa 0xe77(%rip),%xmm8
movdqa 0xe7f(%rip),%xmm0
movdqa 0xe86(%rip),%xmm13
movdqa 0xe8d(%rip),%xmm14
xorps  %xmm5,%xmm5
xor    %edx,%edx
movdqa 0xe9f(%rip),%xmm11
movdqa 0xea6(%rip),%xmm9
movdqa %xmm12,(%rsp)
movdqa %xmm2,-0x70(%rsp)
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm8,-0x30(%rsp)
movdqa %xmm0,-0x80(%rsp)
movdqa %xmm4,-0x60(%rsp)
movdqa %xmm6,-0x50(%rsp)
movdqa %xmm3,-0x40(%rsp)
movdqa %xmm14,%xmm0
pxor   %xmm11,%xmm0
pxor   %xmm11,%xmm12
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm15
por    %xmm0,%xmm15
pand   %xmm9,%xmm15
movdqa %xmm13,%xmm0
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
por    %xmm0,%xmm2
pand   %xmm9,%xmm2
packuswb %xmm2,%xmm15
packuswb %xmm15,%xmm15
movdqa -0x80(%rsp),%xmm0
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
por    %xmm0,%xmm2
pand   %xmm9,%xmm2
movdqa %xmm8,%xmm0
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm7
pcmpgtd %xmm0,%xmm7
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm7,%xmm0
pshufd $0xf5,%xmm7,%xmm7
por    %xmm0,%xmm7
pand   %xmm9,%xmm7
packuswb %xmm7,%xmm2
packuswb %xmm2,%xmm0
packuswb %xmm0,%xmm15
movdqa %xmm4,%xmm0
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm7
pand   %xmm2,%xmm7
pshufd $0xf5,%xmm2,%xmm0
por    %xmm7,%xmm0
pand   %xmm9,%xmm0
pxor   %xmm11,%xmm6
movdqa %xmm12,%xmm7
pcmpgtd %xmm6,%xmm7
pcmpeqd %xmm12,%xmm6
pshufd $0xf5,%xmm6,%xmm2
pand   %xmm7,%xmm2
pshufd $0xf5,%xmm7,%xmm7
por    %xmm2,%xmm7
pand   %xmm9,%xmm7
packuswb %xmm7,%xmm0
movdqa %xmm3,%xmm2
pxor   %xmm11,%xmm2
movdqa %xmm12,%xmm7
pcmpgtd %xmm2,%xmm7
pcmpeqd %xmm12,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm7,%xmm2
pshufd $0xf5,%xmm7,%xmm3
por    %xmm2,%xmm3
movdqa %xmm10,%xmm2
pxor   %xmm11,%xmm2
movdqa %xmm12,%xmm7
pcmpgtd %xmm2,%xmm7
pcmpeqd %xmm12,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm7,%xmm2
pshufd $0xf5,%xmm7,%xmm7
por    %xmm2,%xmm7
movdqa %xmm10,%xmm6
movdqa 0xcba(%rip),%xmm4
paddq  %xmm4,%xmm10
pand   %xmm9,%xmm3
pand   %xmm9,%xmm7
packuswb %xmm7,%xmm3
movdqa %xmm8,%xmm7
paddq  %xmm4,%xmm7
packuswb %xmm0,%xmm0
packuswb %xmm3,%xmm2
packuswb %xmm2,%xmm0
movdqa %xmm13,%xmm2
paddq  %xmm4,%xmm2
shufps $0xcc,%xmm0,%xmm15
movups (%rdi,%rdx,1),%xmm0
xorps  -0x70(%rsp),%xmm0
andnps %xmm0,%xmm15
movdqa %xmm14,%xmm0
paddq  %xmm4,%xmm0
orps   %xmm1,%xmm15
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm1
pcmpgtd %xmm0,%xmm1
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm1,%xmm0
pshufd $0xf5,%xmm1,%xmm8
por    %xmm0,%xmm8
pxor   %xmm11,%xmm2
movdqa %xmm12,%xmm0
pcmpgtd %xmm2,%xmm0
pcmpeqd %xmm12,%xmm2
pshufd $0xf5,%xmm2,%xmm1
pand   %xmm0,%xmm1
pshufd $0xf5,%xmm0,%xmm0
por    %xmm1,%xmm0
movdqa -0x80(%rsp),%xmm1
paddq  %xmm4,%xmm1
pand   %xmm9,%xmm8
pand   %xmm9,%xmm0
packuswb %xmm0,%xmm8
pxor   %xmm11,%xmm1
movdqa %xmm12,%xmm0
pcmpgtd %xmm1,%xmm0
pcmpeqd %xmm12,%xmm1
pshufd $0xf5,%xmm1,%xmm1
pand   %xmm0,%xmm1
pshufd $0xf5,%xmm0,%xmm0
por    %xmm1,%xmm0
pxor   %xmm11,%xmm7
movdqa %xmm12,%xmm1
pcmpgtd %xmm7,%xmm1
pcmpeqd %xmm12,%xmm7
pshufd $0xf5,%xmm7,%xmm2
pand   %xmm1,%xmm2
pshufd $0xf5,%xmm1,%xmm1
por    %xmm2,%xmm1
movdqa -0x50(%rsp),%xmm2
paddq  %xmm4,%xmm2
pand   %xmm9,%xmm0
pand   %xmm9,%xmm1
packuswb %xmm1,%xmm0
movdqa -0x60(%rsp),%xmm1
paddq  %xmm4,%xmm1
packuswb %xmm8,%xmm8
packuswb %xmm0,%xmm0
packuswb %xmm0,%xmm8
pxor   %xmm11,%xmm1
movdqa %xmm12,%xmm0
pcmpgtd %xmm1,%xmm0
pcmpeqd %xmm12,%xmm1
pshufd $0xf5,%xmm1,%xmm1
pand   %xmm0,%xmm1
pshufd $0xf5,%xmm0,%xmm0
por    %xmm1,%xmm0
pxor   %xmm11,%xmm2
movdqa %xmm12,%xmm1
pcmpgtd %xmm2,%xmm1
pcmpeqd %xmm12,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm1,%xmm2
pshufd $0xf5,%xmm1,%xmm1
por    %xmm2,%xmm1
movdqa -0x40(%rsp),%xmm2
paddq  %xmm4,%xmm2
pand   %xmm9,%xmm0
pand   %xmm9,%xmm1
packuswb %xmm1,%xmm0
pxor   %xmm11,%xmm2
movdqa %xmm12,%xmm1
pcmpgtd %xmm2,%xmm1
pcmpeqd %xmm12,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm1,%xmm2
pshufd $0xf5,%xmm1,%xmm1
por    %xmm2,%xmm1
pxor   %xmm11,%xmm10
movdqa %xmm12,%xmm2
pcmpgtd %xmm10,%xmm2
pcmpeqd %xmm12,%xmm10
pshufd $0xf5,%xmm10,%xmm3
movdqa %xmm6,%xmm10
pand   %xmm2,%xmm3
pshufd $0xf5,%xmm2,%xmm2
por    %xmm3,%xmm2
movups 0x10(%rdi,%rdx,1),%xmm3
xorps  -0x70(%rsp),%xmm3
packuswb %xmm0,%xmm0
pand   %xmm9,%xmm1
pand   %xmm9,%xmm2
packuswb %xmm2,%xmm1
packuswb %xmm1,%xmm1
packuswb %xmm1,%xmm0
shufps $0xcc,%xmm0,%xmm8
andnps %xmm3,%xmm8
orps   %xmm5,%xmm8
movdqa %xmm6,%xmm5
movdqa 0xacb(%rip),%xmm4
paddq  %xmm4,%xmm5
movdqa -0x30(%rsp),%xmm7
paddq  %xmm4,%xmm7
movdqa %xmm13,%xmm0
paddq  %xmm4,%xmm0
movdqa %xmm14,%xmm1
paddq  %xmm4,%xmm1
pxor   %xmm11,%xmm1
movdqa %xmm12,%xmm2
pcmpgtd %xmm1,%xmm2
pcmpeqd %xmm12,%xmm1
pshufd $0xf5,%xmm1,%xmm3
pand   %xmm2,%xmm3
pshufd $0xf5,%xmm2,%xmm1
por    %xmm3,%xmm1
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
por    %xmm0,%xmm2
movdqa -0x80(%rsp),%xmm0
paddq  %xmm4,%xmm0
pand   %xmm9,%xmm1
pand   %xmm9,%xmm2
packuswb %xmm2,%xmm1
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
por    %xmm0,%xmm2
pxor   %xmm11,%xmm7
movdqa %xmm12,%xmm0
pcmpgtd %xmm7,%xmm0
pcmpeqd %xmm12,%xmm7
pshufd $0xf5,%xmm7,%xmm3
pand   %xmm0,%xmm3
pshufd $0xf5,%xmm0,%xmm0
por    %xmm3,%xmm0
movdqa -0x50(%rsp),%xmm3
paddq  %xmm4,%xmm3
pand   %xmm9,%xmm2
pand   %xmm9,%xmm0
packuswb %xmm0,%xmm2
movdqa -0x60(%rsp),%xmm0
paddq  %xmm4,%xmm0
packuswb %xmm1,%xmm1
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm1
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
por    %xmm0,%xmm2
pxor   %xmm11,%xmm3
movdqa %xmm12,%xmm0
pcmpgtd %xmm3,%xmm0
pcmpeqd %xmm12,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm0,%xmm3
pshufd $0xf5,%xmm0,%xmm0
por    %xmm3,%xmm0
movdqa -0x40(%rsp),%xmm3
paddq  %xmm4,%xmm3
pand   %xmm9,%xmm2
pand   %xmm9,%xmm0
packuswb %xmm0,%xmm2
pxor   %xmm11,%xmm3
movdqa %xmm12,%xmm0
pcmpgtd %xmm3,%xmm0
pcmpeqd %xmm12,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm0,%xmm3
pshufd $0xf5,%xmm0,%xmm0
por    %xmm3,%xmm0
pxor   %xmm11,%xmm5
movdqa %xmm12,%xmm3
pcmpgtd %xmm5,%xmm3
pcmpeqd %xmm12,%xmm5
pshufd $0xf5,%xmm5,%xmm5
pand   %xmm3,%xmm5
pshufd $0xf5,%xmm3,%xmm3
por    %xmm5,%xmm3
movups 0x20(%rdi,%rdx,1),%xmm5
pand   %xmm9,%xmm0
pand   %xmm9,%xmm3
packuswb %xmm3,%xmm0
movdqa %xmm6,%xmm7
movdqa 0x916(%rip),%xmm4
paddq  %xmm4,%xmm7
packuswb %xmm2,%xmm2
packuswb %xmm0,%xmm0
packuswb %xmm0,%xmm2
movdqa -0x30(%rsp),%xmm0
paddq  %xmm4,%xmm0
shufps $0xcc,%xmm2,%xmm1
movdqa %xmm13,%xmm2
paddq  %xmm4,%xmm2
xorps  -0x70(%rsp),%xmm5
andnps %xmm5,%xmm1
movdqa %xmm14,%xmm3
paddq  %xmm4,%xmm3
orps   %xmm15,%xmm1
pxor   %xmm11,%xmm3
movdqa %xmm12,%xmm5
pcmpgtd %xmm3,%xmm5
pcmpeqd %xmm12,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm5,%xmm3
pshufd $0xf5,%xmm5,%xmm5
por    %xmm3,%xmm5
pxor   %xmm11,%xmm2
movdqa %xmm12,%xmm3
pcmpgtd %xmm2,%xmm3
pcmpeqd %xmm12,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm3,%xmm2
pshufd $0xf5,%xmm3,%xmm3
por    %xmm2,%xmm3
movdqa -0x80(%rsp),%xmm2
paddq  %xmm4,%xmm2
pand   %xmm9,%xmm5
pand   %xmm9,%xmm3
packuswb %xmm3,%xmm5
pxor   %xmm11,%xmm2
movdqa %xmm12,%xmm3
pcmpgtd %xmm2,%xmm3
pcmpeqd %xmm12,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm3,%xmm2
pshufd $0xf5,%xmm3,%xmm3
por    %xmm2,%xmm3
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
por    %xmm0,%xmm2
movdqa -0x50(%rsp),%xmm6
paddq  %xmm4,%xmm6
pand   %xmm9,%xmm3
pand   %xmm9,%xmm2
packuswb %xmm2,%xmm3
movdqa -0x60(%rsp),%xmm0
paddq  %xmm4,%xmm0
packuswb %xmm5,%xmm5
packuswb %xmm3,%xmm2
packuswb %xmm2,%xmm5
pxor   %xmm11,%xmm0
movdqa %xmm12,%xmm2
pcmpgtd %xmm0,%xmm2
pcmpeqd %xmm12,%xmm0
pshufd $0xf5,%xmm0,%xmm3
pand   %xmm2,%xmm3
pshufd $0xf5,%xmm2,%xmm0
por    %xmm3,%xmm0
pxor   %xmm11,%xmm6
movdqa %xmm12,%xmm2
pcmpgtd %xmm6,%xmm2
pcmpeqd %xmm12,%xmm6
pshufd $0xf5,%xmm6,%xmm3
pand   %xmm2,%xmm3
pshufd $0xf5,%xmm2,%xmm2
por    %xmm3,%xmm2
movdqa -0x40(%rsp),%xmm3
paddq  %xmm4,%xmm3
pand   %xmm9,%xmm0
pand   %xmm9,%xmm2
packuswb %xmm2,%xmm0
pxor   %xmm11,%xmm3
movdqa %xmm12,%xmm2
pcmpgtd %xmm3,%xmm2
pcmpeqd %xmm12,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm2,%xmm3
pshufd $0xf5,%xmm2,%xmm2
por    %xmm3,%xmm2
pxor   %xmm11,%xmm7
movdqa %xmm12,%xmm3
pcmpgtd %xmm7,%xmm3
pcmpeqd %xmm12,%xmm7
pshufd $0xf5,%xmm7,%xmm6
movdqa (%rsp),%xmm12
pand   %xmm3,%xmm6
pshufd $0xf5,%xmm3,%xmm3
por    %xmm6,%xmm3
movdqa -0x50(%rsp),%xmm6
pand   %xmm9,%xmm2
pand   %xmm9,%xmm3
packuswb %xmm3,%xmm2
movdqa -0x40(%rsp),%xmm3
packuswb %xmm0,%xmm0
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm0
movaps -0x70(%rsp),%xmm2
shufps $0xcc,%xmm0,%xmm5
movups 0x30(%rdi,%rdx,1),%xmm0
xorps  %xmm2,%xmm0
andnps %xmm0,%xmm5
movdqa -0x80(%rsp),%xmm0
orps   %xmm8,%xmm5
movdqa -0x30(%rsp),%xmm8
movdqa -0x60(%rsp),%xmm4
add    $0x40,%rdx
movdqa 0x701(%rip),%xmm7
paddq  %xmm7,%xmm14
paddq  %xmm7,%xmm13
paddq  %xmm7,%xmm0
paddq  %xmm7,%xmm8
paddq  %xmm7,%xmm4
paddq  %xmm7,%xmm6
paddq  %xmm7,%xmm3
paddq  %xmm7,%xmm10
add    $0xfffffffffffffffe,%rax
jne    1210 <get_pkcs_padding+0x110>
test   $0x1,%r9b
je     1e15 <get_pkcs_padding+0xd15>
movdqa 0x670(%rip),%xmm11
movdqa %xmm10,%xmm7
paddq  %xmm11,%xmm7
movdqa %xmm7,-0x40(%rsp)
movdqa %xmm3,%xmm7
paddq  %xmm11,%xmm7
movdqa %xmm7,-0x50(%rsp)
movdqa %xmm6,%xmm7
paddq  %xmm11,%xmm7
movdqa %xmm7,-0x60(%rsp)
movdqu (%rdi,%rdx,1),%xmm7
movdqu 0x10(%rdi,%rdx,1),%xmm9
pxor   %xmm2,%xmm7
movdqa %xmm7,-0x20(%rsp)
pxor   %xmm2,%xmm9
movdqa %xmm9,-0x80(%rsp)
movdqa %xmm4,%xmm2
paddq  %xmm11,%xmm2
movdqa %xmm2,-0x70(%rsp)
movdqa %xmm3,%xmm9
movdqa %xmm10,%xmm15
movdqa %xmm8,%xmm2
paddq  %xmm11,%xmm2
movdqa %xmm2,-0x30(%rsp)
movdqa %xmm0,%xmm2
paddq  %xmm11,%xmm2
movdqa %xmm2,-0x10(%rsp)
movdqa %xmm13,%xmm10
paddq  %xmm11,%xmm10
paddq  %xmm14,%xmm11
movdqa 0x5e1(%rip),%xmm2
pxor   %xmm2,%xmm14
pxor   %xmm2,%xmm12
movdqa %xmm2,%xmm7
movdqa %xmm0,%xmm3
movdqa %xmm12,%xmm0
pcmpgtd %xmm14,%xmm0
pcmpeqd %xmm12,%xmm14
pshufd $0xf5,%xmm14,%xmm2
pand   %xmm0,%xmm2
pshufd $0xf5,%xmm0,%xmm14
por    %xmm2,%xmm14
pxor   %xmm7,%xmm13
movdqa %xmm12,%xmm0
pcmpgtd %xmm13,%xmm0
pcmpeqd %xmm12,%xmm13
pshufd $0xf5,%xmm13,%xmm2
pand   %xmm0,%xmm2
pshufd $0xf5,%xmm0,%xmm0
por    %xmm2,%xmm0
movdqa 0x58c(%rip),%xmm2
pand   %xmm2,%xmm14
pand   %xmm2,%xmm0
packuswb %xmm0,%xmm14
movdqa %xmm7,%xmm2
pxor   %xmm7,%xmm3
movdqa %xmm12,%xmm0
pcmpgtd %xmm3,%xmm0
pcmpeqd %xmm12,%xmm3
pshufd $0xf5,%xmm3,%xmm7
pand   %xmm0,%xmm7
pshufd $0xf5,%xmm0,%xmm0
por    %xmm7,%xmm0
pxor   %xmm2,%xmm8
movdqa %xmm2,%xmm3
movdqa %xmm12,%xmm7
pcmpgtd %xmm8,%xmm7
pcmpeqd %xmm12,%xmm8
pshufd $0xf5,%xmm8,%xmm2
pand   %xmm7,%xmm2
pshufd $0xf5,%xmm7,%xmm7
por    %xmm2,%xmm7
movdqa 0x522(%rip),%xmm8
pand   %xmm8,%xmm0
pand   %xmm8,%xmm7
packuswb %xmm7,%xmm0
packuswb %xmm14,%xmm14
packuswb %xmm0,%xmm0
packuswb %xmm0,%xmm14
pxor   %xmm3,%xmm4
movdqa %xmm12,%xmm0
pcmpgtd %xmm4,%xmm0
pcmpeqd %xmm12,%xmm4
pshufd $0xf5,%xmm4,%xmm2
pand   %xmm0,%xmm2
pshufd $0xf5,%xmm0,%xmm0
por    %xmm2,%xmm0
pxor   %xmm3,%xmm6
movdqa %xmm3,%xmm4
movdqa %xmm12,%xmm2
pcmpgtd %xmm6,%xmm2
pcmpeqd %xmm12,%xmm6
pshufd $0xf5,%xmm6,%xmm7
pand   %xmm2,%xmm7
pshufd $0xf5,%xmm2,%xmm2
por    %xmm7,%xmm2
pand   %xmm8,%xmm0
pand   %xmm8,%xmm2
packuswb %xmm2,%xmm0
pxor   %xmm3,%xmm9
movdqa %xmm12,%xmm2
pcmpgtd %xmm9,%xmm2
pcmpeqd %xmm12,%xmm9
pshufd $0xf5,%xmm9,%xmm7
pand   %xmm2,%xmm7
pshufd $0xf5,%xmm2,%xmm2
por    %xmm7,%xmm2
pxor   %xmm3,%xmm15
movdqa %xmm12,%xmm7
pcmpgtd %xmm15,%xmm7
pcmpeqd %xmm12,%xmm15
pshufd $0xf5,%xmm15,%xmm3
pand   %xmm7,%xmm3
pshufd $0xf5,%xmm7,%xmm7
por    %xmm3,%xmm7
pand   %xmm8,%xmm2
pand   %xmm8,%xmm7
packuswb %xmm7,%xmm2
packuswb %xmm0,%xmm0
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm0
shufps $0xcc,%xmm0,%xmm14
andnps -0x20(%rsp),%xmm14
orps   %xmm14,%xmm1
movdqa %xmm4,%xmm7
pxor   %xmm4,%xmm11
movdqa %xmm12,%xmm0
pcmpgtd %xmm11,%xmm0
pcmpeqd %xmm12,%xmm11
pshufd $0xf5,%xmm11,%xmm2
pand   %xmm0,%xmm2
pshufd $0xf5,%xmm0,%xmm0
por    %xmm2,%xmm0
pxor   %xmm4,%xmm10
movdqa %xmm12,%xmm2
pcmpgtd %xmm10,%xmm2
pcmpeqd %xmm12,%xmm10
pshufd $0xf5,%xmm10,%xmm3
pand   %xmm2,%xmm3
pshufd $0xf5,%xmm2,%xmm2
por    %xmm3,%xmm2
pand   %xmm8,%xmm0
pand   %xmm8,%xmm2
packuswb %xmm2,%xmm0
movdqa -0x10(%rsp),%xmm3
pxor   %xmm4,%xmm3
movdqa %xmm12,%xmm2
pcmpgtd %xmm3,%xmm2
pcmpeqd %xmm12,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm2,%xmm3
pshufd $0xf5,%xmm2,%xmm2
por    %xmm3,%xmm2
movdqa -0x30(%rsp),%xmm4
pxor   %xmm7,%xmm4
movdqa %xmm12,%xmm3
pcmpgtd %xmm4,%xmm3
pcmpeqd %xmm12,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm3,%xmm4
pshufd $0xf5,%xmm3,%xmm3
por    %xmm4,%xmm3
pand   %xmm8,%xmm2
pand   %xmm8,%xmm3
packuswb %xmm3,%xmm2
packuswb %xmm0,%xmm0
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm0
movdqa -0x70(%rsp),%xmm3
pxor   %xmm7,%xmm3
movdqa %xmm12,%xmm2
pcmpgtd %xmm3,%xmm2
pcmpeqd %xmm12,%xmm3
pshufd $0xf5,%xmm3,%xmm4
pand   %xmm2,%xmm4
pshufd $0xf5,%xmm2,%xmm3
por    %xmm4,%xmm3
movdqa -0x60(%rsp),%xmm4
pxor   %xmm7,%xmm4
movdqa %xmm12,%xmm2
pcmpgtd %xmm4,%xmm2
pcmpeqd %xmm12,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm2,%xmm4
pshufd $0xf5,%xmm2,%xmm2
por    %xmm4,%xmm2
pand   %xmm8,%xmm3
pand   %xmm8,%xmm2
packuswb %xmm2,%xmm3
movdqa -0x50(%rsp),%xmm4
pxor   %xmm7,%xmm4
movdqa %xmm12,%xmm2
pcmpgtd %xmm4,%xmm2
pcmpeqd %xmm12,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm2,%xmm4
pshufd $0xf5,%xmm2,%xmm2
por    %xmm4,%xmm2
movdqa -0x40(%rsp),%xmm6
pxor   %xmm7,%xmm6
movdqa %xmm12,%xmm4
pcmpgtd %xmm6,%xmm4
pcmpeqd %xmm12,%xmm6
pshufd $0xf5,%xmm6,%xmm6
pand   %xmm4,%xmm6
pshufd $0xf5,%xmm4,%xmm4
por    %xmm6,%xmm4
pand   %xmm8,%xmm2
pand   %xmm8,%xmm4
packuswb %xmm4,%xmm2
packuswb %xmm3,%xmm3
packuswb %xmm2,%xmm2
packuswb %xmm2,%xmm3
shufps $0xcc,%xmm3,%xmm0
andnps -0x80(%rsp),%xmm0
orps   %xmm0,%xmm5
orps   %xmm5,%xmm1
pshufd $0xee,%xmm1,%xmm0
por    %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
por    %xmm0,%xmm1
movdqa %xmm1,%xmm0
psrld  $0x10,%xmm0
por    %xmm1,%xmm0
movdqa %xmm0,%xmm1
psrlw  $0x8,%xmm1
por    %xmm0,%xmm1
movd   %xmm1,%eax
cmp    %r10,%rsi
je     1e6c <get_pkcs_padding+0xd6c>
nopl   (%rax)
movzbl (%rdi,%rsi,1),%ecx
xor    %r11b,%cl
cmp    %rbx,%rsi
movzbl %cl,%ecx
cmovb  %r8d,%ecx
or     %cl,%al
add    $0x1,%rsi
cmp    %rsi,%r10
jne    1e50 <get_pkcs_padding+0xd50>
xor    %ecx,%ecx
test   %al,%al
mov    $0xffff9e00,%eax
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret
movdqa 0x179(%rip),%xmm10
movdqa 0x181(%rip),%xmm3
movdqa 0x189(%rip),%xmm6
movdqa 0x191(%rip),%xmm4
movdqa 0x198(%rip),%xmm8
movdqa 0x1a0(%rip),%xmm0
movdqa 0x1a7(%rip),%xmm13
movdqa 0x1ae(%rip),%xmm14
xorps  %xmm5,%xmm5
xor    %edx,%edx
test   $0x1,%r9b
jne    1a07 <get_pkcs_padding+0x907>
jmp    1e15 <get_pkcs_padding+0xd15>

LLVM IR (-O0):
define i32 @get_pkcs_padding(i8* %0, i32 %1, i64* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
store i8* %0, i8** %5
store i32 %1, i32* %6
store i64* %2, i64** %7
store i8 0, i8* %11
%12 = load i8*, i8** %5
%13 = icmp eq i8* null, %12
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = load i64*, i64** %7
%16 = icmp eq i64* null, %15
br i1 %16, label %17, label %18
17: ; preds = %14, %3
store i32 -24832, i32* %4
br label %84
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = load i32, i32* %6
%21 = sub i32 %20, 1
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
store i8 %24, i8* %10
%25 = load i32, i32* %6
%26 = load i8, i8* %10
%27 = zext i8 %26 to i32
%28 = sub i32 %25, %27
%29 = zext i32 %28 to i64
%30 = load i64*, i64** %7
store i64 %29, i64* %30
%31 = load i8, i8* %10
%32 = zext i8 %31 to i32
%33 = load i32, i32* %6
%34 = icmp ugt i32 %32, %33
%35 = zext i1 %34 to i32
%36 = load i8, i8* %11
%37 = zext i8 %36 to i32
%38 = or i32 %37, %35
%39 = trunc i32 %38 to i8
store i8 %39, i8* %11
%40 = load i8, i8* %10
%41 = zext i8 %40 to i32
%42 = icmp eq i32 %41, 0
%43 = zext i1 %42 to i32
%44 = load i8, i8* %11
%45 = zext i8 %44 to i32
%46 = or i32 %45, %43
%47 = trunc i32 %46 to i8
store i8 %47, i8* %11
%48 = load i32, i32* %6
%49 = load i8, i8* %10
%50 = zext i8 %49 to i32
%51 = sub i32 %48, %50
store i32 %51, i32* %9
store i32 0, i32* %8
br label %52
52: ; preds = %75, %18
%53 = load i32, i32* %8
%54 = load i32, i32* %6
%55 = icmp ult i32 %53, %54
br i1 %55, label %56, label %78
56: ; preds = %52
%57 = load i8*, i8** %5
%58 = load i32, i32* %8
%59 = zext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %57, i64 %59
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = load i8, i8* %10
%64 = zext i8 %63 to i32
%65 = xor i32 %62, %64
%66 = load i32, i32* %8
%67 = load i32, i32* %9
%68 = icmp uge i32 %66, %67
%69 = zext i1 %68 to i32
%70 = mul nsw i32 %65, %69
%71 = load i8, i8* %11
%72 = zext i8 %71 to i32
%73 = or i32 %72, %70
%74 = trunc i32 %73 to i8
store i8 %74, i8* %11
br label %75
75: ; preds = %56
%76 = load i32, i32* %8
%77 = add i32 %76, 1
store i32 %77, i32* %8
br label %52
78: ; preds = %52
%79 = load i8, i8* %11
%80 = zext i8 %79 to i32
%81 = icmp ne i32 %80, 0
%82 = zext i1 %81 to i32
%83 = mul nsw i32 -25088, %82
store i32 %83, i32* %4
br label %84
84: ; preds = %78, %17
%85 = load i32, i32* %4
ret i32 %85
}

LLVM IR (-O2):
define i32 @get_pkcs_padding(i8* %0, i32 %1, i64* writeonly %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i64* %2, null
%6 = or i1 %4, %5
br i1 %6, label %131, label %7
7: ; preds = %3
%8 = add i32 %1, -1
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = sub i32 %1, %12
%14 = zext i32 %13 to i64
store i64 %14, i64* %2
%15 = icmp ugt i32 %12, %1
%16 = icmp eq i8 %11, 0
%17 = or i1 %16, %15
%18 = zext i1 %17 to i8
%19 = icmp eq i32 %1, 0
br i1 %19, label %127, label %20
20: ; preds = %7
%21 = zext i32 %1 to i64
%22 = icmp ult i32 %1, 32
br i1 %22, label %113, label %23
23: ; preds = %20
%24 = and i64 %21, 4294967264
%25 = insertelement <16 x i8> <i8 poison, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %18, i64 0
%26 = insertelement <16 x i8> poison, i8 %11, i64 0
%27 = shufflevector <16 x i8> %26, <16 x i8> poison, <16 x i32> zeroinitializer
%28 = insertelement <16 x i8> poison, i8 %11, i64 0
%29 = shufflevector <16 x i8> %28, <16 x i8> poison, <16 x i32> zeroinitializer
%30 = insertelement <16 x i64> poison, i64 %14, i64 0
%31 = shufflevector <16 x i64> %30, <16 x i64> poison, <16 x i32> zeroinitializer
%32 = insertelement <16 x i64> poison, i64 %14, i64 0
%33 = shufflevector <16 x i64> %32, <16 x i64> poison, <16 x i32> zeroinitializer
%34 = add nsw i64 %24, -32
%35 = lshr exact i64 %34, 5
%36 = add nuw nsw i64 %35, 1
%37 = and i64 %36, 1
%38 = icmp eq i64 %34, 0
br i1 %38, label %83, label %39
39: ; preds = %23
%40 = and i64 %36, 1152921504606846974
br label %41
41: ; preds = %41, %39
%42 = phi i64 [ 0, %39 ], [ %79, %41 ]
%43 = phi <16 x i64> [ <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>, %39 ], [ %80, %41 ]
%44 = phi <16 x i8> [ %25, %39 ], [ %77, %41 ]
%45 = phi <16 x i8> [ zeroinitializer, %39 ], [ %78, %41 ]
%46 = phi i64 [ 0, %39 ], [ %81, %41 ]
%47 = add <16 x i64> %43, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
%48 = getelementptr inbounds i8, i8* %0, i64 %42
%49 = bitcast i8* %48 to <16 x i8>*
%50 = load <16 x i8>, <16 x i8>* %49
%51 = getelementptr inbounds i8, i8* %48, i64 16
%52 = bitcast i8* %51 to <16 x i8>*
%53 = load <16 x i8>, <16 x i8>* %52
%54 = xor <16 x i8> %50, %27
%55 = xor <16 x i8> %53, %29
%56 = icmp ult <16 x i64> %43, %31
%57 = icmp ult <16 x i64> %47, %33
%58 = select <16 x i1> %56, <16 x i8> zeroinitializer, <16 x i8> %54
%59 = select <16 x i1> %57, <16 x i8> zeroinitializer, <16 x i8> %55
%60 = or <16 x i8> %58, %44
%61 = or <16 x i8> %59, %45
%62 = or i64 %42, 32
%63 = add <16 x i64> %43, <i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32>
%64 = add <16 x i64> %43, <i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48, i64 48>
%65 = getelementptr inbounds i8, i8* %0, i64 %62
%66 = bitcast i8* %65 to <16 x i8>*
%67 = load <16 x i8>, <16 x i8>* %66
%68 = getelementptr inbounds i8, i8* %65, i64 16
%69 = bitcast i8* %68 to <16 x i8>*
%70 = load <16 x i8>, <16 x i8>* %69
%71 = xor <16 x i8> %67, %27
%72 = xor <16 x i8> %70, %29
%73 = icmp ult <16 x i64> %63, %31
%74 = icmp ult <16 x i64> %64, %33
%75 = select <16 x i1> %73, <16 x i8> zeroinitializer, <16 x i8> %71
%76 = select <16 x i1> %74, <16 x i8> zeroinitializer, <16 x i8> %72
%77 = or <16 x i8> %75, %60
%78 = or <16 x i8> %76, %61
%79 = add nuw i64 %42, 64
%80 = add <16 x i64> %43, <i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64, i64 64>
%81 = add i64 %46, 2
%82 = icmp eq i64 %81, %40
br i1 %82, label %83, label %41
83: ; preds = %41, %23
%84 = phi <16 x i8> [ undef, %23 ], [ %77, %41 ]
%85 = phi <16 x i8> [ undef, %23 ], [ %78, %41 ]
%86 = phi i64 [ 0, %23 ], [ %79, %41 ]
%87 = phi <16 x i64> [ <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>, %23 ], [ %80, %41 ]
%88 = phi <16 x i8> [ %25, %23 ], [ %77, %41 ]
%89 = phi <16 x i8> [ zeroinitializer, %23 ], [ %78, %41 ]
%90 = icmp eq i64 %37, 0
br i1 %90, label %107, label %91
91: ; preds = %83
%92 = add <16 x i64> %87, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
%93 = getelementptr inbounds i8, i8* %0, i64 %86
%94 = bitcast i8* %93 to <16 x i8>*
%95 = load <16 x i8>, <16 x i8>* %94
%96 = getelementptr inbounds i8, i8* %93, i64 16
%97 = bitcast i8* %96 to <16 x i8>*
%98 = load <16 x i8>, <16 x i8>* %97
%99 = xor <16 x i8> %95, %27
%100 = xor <16 x i8> %98, %29
%101 = icmp ult <16 x i64> %87, %31
%102 = icmp ult <16 x i64> %92, %33
%103 = select <16 x i1> %101, <16 x i8> zeroinitializer, <16 x i8> %99
%104 = select <16 x i1> %102, <16 x i8> zeroinitializer, <16 x i8> %100
%105 = or <16 x i8> %103, %88
%106 = or <16 x i8> %104, %89
br label %107
107: ; preds = %83, %91
%108 = phi <16 x i8> [ %84, %83 ], [ %105, %91 ]
%109 = phi <16 x i8> [ %85, %83 ], [ %106, %91 ]
%110 = or <16 x i8> %109, %108
%111 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> %110)
%112 = icmp eq i64 %24, %21
br i1 %112, label %127, label %113
113: ; preds = %20, %107
%114 = phi i64 [ 0, %20 ], [ %24, %107 ]
%115 = phi i8 [ %18, %20 ], [ %111, %107 ]
br label %116
116: ; preds = %113, %116
%117 = phi i64 [ %125, %116 ], [ %114, %113 ]
%118 = phi i8 [ %124, %116 ], [ %115, %113 ]
%119 = getelementptr inbounds i8, i8* %0, i64 %117
%120 = load i8, i8* %119
%121 = xor i8 %120, %11
%122 = icmp ult i64 %117, %14
%123 = select i1 %122, i8 0, i8 %121
%124 = or i8 %123, %118
%125 = add nuw nsw i64 %117, 1
%126 = icmp eq i64 %125, %21
br i1 %126, label %127, label %116
127: ; preds = %116, %107, %7
%128 = phi i8 [ %18, %7 ], [ %111, %107 ], [ %124, %116 ]
%129 = icmp eq i8 %128, 0
%130 = select i1 %129, i32 0, i32 -25088
br label %131
131: ; preds = %3, %127
%132 = phi i32 [ %130, %127 ], [ -24832, %3 ]
ret i32 %132
}