#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 */
typedef int uint32_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_setr_epi8(int, int, int, int, int, int, int, int, int,
                                 int, int, int, int, int, int, int);
int /*<<< orphan*/ _mm_shuffle_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_shuffle_epi8(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_slli_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_srli_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
void xor_chacha_sidm_swap(__m128i *calc_16, __m128i *calc_12, __m128i *calc_8,
                          __m128i *calc_7, __m128i *calc_1, __m128i *calc_2,
                          __m128i *calc_3, __m128i *calc_4,
                          uint32_t double_rounds) {
  int i;
  __m128i _calc;
  __m128i _rotate_16 =
      _mm_setr_epi8(2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9, 14, 15, 12, 13);
  __m128i _rotate_8 =
      _mm_setr_epi8(3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10, 15, 12, 13, 14);
  __m128i rowa = _mm_xor_si128(*calc_16, *calc_1);
  __m128i rowb = _mm_xor_si128(*calc_12, *calc_2);
  __m128i rowc = _mm_xor_si128(*calc_8, *calc_3);
  __m128i rowd = _mm_xor_si128(*calc_7, *calc_4);
  *calc_16 = _mm_xor_si128(*calc_16, *calc_1);
  *calc_12 = _mm_xor_si128(*calc_12, *calc_2);
  *calc_8 = _mm_xor_si128(*calc_8, *calc_3);
  *calc_7 = _mm_xor_si128(*calc_7, *calc_4);
  for (i = 0; i < double_rounds; i++) {
    rowa = _mm_add_epi32(rowa, rowb);
    rowd = _mm_xor_si128(rowd, rowa);
    rowd = _mm_shuffle_epi8(rowd, _rotate_16);
    rowc = _mm_add_epi32(rowc, rowd);
    _calc = _mm_xor_si128(rowb, rowc);
    rowb = _mm_slli_epi32(_calc, (12));
    _calc = _mm_srli_epi32(_calc, (32 - 12));
    rowb = _mm_xor_si128(rowb, _calc);
    rowa = _mm_add_epi32(rowa, rowb);
    rowd = _mm_xor_si128(rowd, rowa);
    rowd = _mm_shuffle_epi8(rowd, _rotate_8);
    rowc = _mm_add_epi32(rowc, rowd);
    _calc = _mm_xor_si128(rowb, rowc);
    rowb = _mm_slli_epi32(_calc, (7));
    _calc = _mm_srli_epi32(_calc, (32 - 7));
    rowb = _mm_xor_si128(rowb, _calc);
    rowb = _mm_shuffle_epi32(rowb, 0x39);
    rowc = _mm_shuffle_epi32(rowc, 0x4e);
    rowd = _mm_shuffle_epi32(rowd, 0x93);
    rowa = _mm_add_epi32(rowa, rowb);
    rowd = _mm_xor_si128(rowd, rowa);
    rowd = _mm_shuffle_epi8(rowd, _rotate_16);
    rowc = _mm_add_epi32(rowc, rowd);
    _calc = _mm_xor_si128(rowb, rowc);
    rowb = _mm_slli_epi32(_calc, (12));
    _calc = _mm_srli_epi32(_calc, (32 - 12));
    rowb = _mm_xor_si128(rowb, _calc);
    rowa = _mm_add_epi32(rowa, rowb);
    rowd = _mm_xor_si128(rowd, rowa);
    rowd = _mm_shuffle_epi8(rowd, _rotate_8);
    rowc = _mm_add_epi32(rowc, rowd);
    _calc = _mm_xor_si128(rowb, rowc);
    rowb = _mm_slli_epi32(_calc, (7));
    _calc = _mm_srli_epi32(_calc, (32 - 7));
    rowb = _mm_xor_si128(rowb, _calc);
    rowb = _mm_shuffle_epi32(rowb, 0x93);
    rowc = _mm_shuffle_epi32(rowc, 0x4e);
    rowd = _mm_shuffle_epi32(rowd, 0x39);
  }
  rowa = _mm_add_epi32(*calc_16, rowa);
  rowb = _mm_add_epi32(*calc_12, rowb);
  rowc = _mm_add_epi32(*calc_8, rowc);
  rowd = _mm_add_epi32(*calc_7, rowd);
  *calc_16 = *calc_1;
  *calc_12 = *calc_2;
  *calc_8 = *calc_3;
  *calc_7 = *calc_4;
  *calc_1 = rowa;
  *calc_2 = rowb;
  *calc_3 = rowc;
  *calc_4 = rowd;
}


x86 assembly (clang, -O0):
<xor_chacha_sidm_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0x2,%edi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x6,%r8d
mov    $0x7,%r9d
movl   $0x4,(%rsp)
movl   $0x5,0x8(%rsp)
movl   $0xa,0x10(%rsp)
movl   $0xb,0x18(%rsp)
movl   $0x8,0x20(%rsp)
movl   $0x9,0x28(%rsp)
movl   $0xe,0x30(%rsp)
movl   $0xf,0x38(%rsp)
movl   $0xc,0x40(%rsp)
movl   $0xd,0x48(%rsp)
call   1050 <_mm_setr_epi8@plt>
mov    %eax,-0x3c(%rbp)
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x7,%r8d
mov    $0x4,%r9d
movl   $0x5,(%rsp)
movl   $0x6,0x8(%rsp)
movl   $0xb,0x10(%rsp)
movl   $0x8,0x18(%rsp)
movl   $0x9,0x20(%rsp)
movl   $0xa,0x28(%rsp)
movl   $0xf,0x30(%rsp)
movl   $0xc,0x38(%rsp)
movl   $0xd,0x40(%rsp)
movl   $0xe,0x48(%rsp)
call   1050 <_mm_setr_epi8@plt>
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    0x18(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    0x18(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    158b <xor_chacha_sidm_swap+0x41b>
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
mov    $0xc,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x14,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %eax,-0x38(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x7,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x19,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %eax,-0x38(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%edi
mov    $0x39,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x4c(%rbp),%edi
mov    $0x4e,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x50(%rbp),%edi
mov    $0x93,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
mov    $0xc,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x14,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %eax,-0x38(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x7,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x19,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %eax,-0x38(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%edi
mov    $0x93,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x4c(%rbp),%edi
mov    $0x4e,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x50(%rbp),%edi
mov    $0x39,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,-0x50(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1341 <xor_chacha_sidm_swap+0x1d1>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x4c(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4c(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x50(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xor_chacha_sidm_swap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,%r14
mov    %r9,0x40(%rsp)
mov    %r8,%rbp
mov    %r8,0x38(%rsp)
mov    %rcx,0x10(%rsp)
mov    %rdx,0x30(%rsp)
mov    %rsi,%r13
mov    %rsi,0x28(%rsp)
mov    %rdi,%r15
mov    $0x2,%edi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x6,%r8d
mov    $0x7,%r9d
push   $0xd
push   $0xc
push   $0xf
push   $0xe
push   $0x9
push   $0x8
push   $0xb
push   $0xa
push   $0x5
push   $0x4
call   1050 <_mm_setr_epi8@plt>
add    $0x50,%rsp
mov    %eax,0x8(%rsp)
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x7,%r8d
mov    $0x4,%r9d
push   $0xe
push   $0xd
push   $0xc
push   $0xf
push   $0xa
push   $0x9
push   $0x8
push   $0xb
push   $0x6
push   $0x5
call   1050 <_mm_setr_epi8@plt>
add    $0x50,%rsp
mov    %eax,0xc(%rsp)
mov    (%r15),%edi
mov    0x0(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%r12d
mov    0x0(%r13),%edi
mov    (%r14),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%r14d
mov    0x30(%rsp),%r13
mov    0x0(%r13),%edi
mov    0x80(%rsp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%rax
mov    (%rax),%edi
mov    0x88(%rsp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    (%r15),%edi
mov    0x38(%rsp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %r15,0x20(%rsp)
mov    %eax,(%r15)
mov    0x28(%rsp),%r15
mov    (%r15),%edi
mov    0x40(%rsp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,(%r15)
mov    0x0(%r13),%edi
mov    0x80(%rsp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,0x0(%r13)
mov    0x10(%rsp),%r15
mov    (%r15),%edi
mov    0x88(%rsp),%rax
mov    (%rax),%esi
call   1070 <_mm_xor_si128@plt>
mov    %r15,%rcx
mov    %eax,(%r15)
mov    0x90(%rsp),%eax
test   %eax,%eax
jle    14ce <xor_chacha_sidm_swap+0x35e>
nop
mov    %eax,0x1c(%rsp)
mov    %r12d,%edi
mov    %r14d,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r12d
mov    %ebp,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    0x8(%rsp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%r13d
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r15d
mov    %r14d,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0xc,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x14,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    %r12d,%edi
mov    %eax,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r14d
mov    %r13d,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    0xc(%rsp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%r12d
mov    %r15d,%edi
mov    %eax,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x7,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x19,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    $0x39,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    $0x4e,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,%r15d
mov    %r12d,%edi
mov    $0x93,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    0x8(%rsp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%r13d
mov    %r15d,%edi
mov    %eax,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0xc,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x14,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    %r12d,%edi
mov    %eax,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r12d
mov    %r13d,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    0xc(%rsp),%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%r15d
mov    %r14d,%edi
mov    %eax,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r13d
mov    %ebp,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x7,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x19,%esi
call   1090 <_mm_srli_epi32@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    $0x93,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,%r14d
mov    %r13d,%edi
mov    $0x4e,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,%ebx
mov    %r15d,%edi
mov    $0x39,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,%ebp
mov    0x1c(%rsp),%eax
add    $0xffffffff,%eax
jne    12e0 <xor_chacha_sidm_swap+0x170>
mov    0x20(%rsp),%rax
mov    (%rax),%edi
mov    %r12d,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,0x8(%rsp)
mov    0x28(%rsp),%r15
mov    (%r15),%edi
mov    %r14d,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r14d
mov    0x30(%rsp),%r13
mov    0x0(%r13),%edi
mov    %ebx,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%r12d
mov    0x10(%rsp),%rbx
mov    (%rbx),%edi
mov    %ebp,%esi
call   1030 <_mm_add_epi32@plt>
mov    0x38(%rsp),%rsi
mov    (%rsi),%ecx
mov    0x20(%rsp),%rdx
mov    %ecx,(%rdx)
mov    0x40(%rsp),%rdx
mov    (%rdx),%ecx
mov    %ecx,(%r15)
mov    0x80(%rsp),%rbp
mov    0x0(%rbp),%ecx
mov    %ecx,0x0(%r13)
mov    0x88(%rsp),%rdi
mov    (%rdi),%ecx
mov    %ecx,(%rbx)
mov    0x8(%rsp),%ecx
mov    %ecx,(%rsi)
mov    %r14d,(%rdx)
mov    %r12d,0x0(%rbp)
mov    %eax,(%rdi)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @xor_chacha_sidm_swap(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32 %8) {
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32* %0, i32** %10
store i32* %1, i32** %11
store i32* %2, i32** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store i32* %7, i32** %17
store i32 %8, i32* %18
%27 = call i32 @_mm_setr_epi8(i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5, i32 10, i32 11, i32 8, i32 9, i32 14, i32 15, i32 12, i32 13)
store i32 %27, i32* %21
%28 = call i32 @_mm_setr_epi8(i32 3, i32 0, i32 1, i32 2, i32 7, i32 4, i32 5, i32 6, i32 11, i32 8, i32 9, i32 10, i32 15, i32 12, i32 13, i32 14)
store i32 %28, i32* %22
%29 = load i32*, i32** %10
%30 = load i32, i32* %29
%31 = load i32*, i32** %14
%32 = load i32, i32* %31
%33 = call i32 @_mm_xor_si128(i32 %30, i32 %32)
store i32 %33, i32* %23
%34 = load i32*, i32** %11
%35 = load i32, i32* %34
%36 = load i32*, i32** %15
%37 = load i32, i32* %36
%38 = call i32 @_mm_xor_si128(i32 %35, i32 %37)
store i32 %38, i32* %24
%39 = load i32*, i32** %12
%40 = load i32, i32* %39
%41 = load i32*, i32** %16
%42 = load i32, i32* %41
%43 = call i32 @_mm_xor_si128(i32 %40, i32 %42)
store i32 %43, i32* %25
%44 = load i32*, i32** %13
%45 = load i32, i32* %44
%46 = load i32*, i32** %17
%47 = load i32, i32* %46
%48 = call i32 @_mm_xor_si128(i32 %45, i32 %47)
store i32 %48, i32* %26
%49 = load i32*, i32** %10
%50 = load i32, i32* %49
%51 = load i32*, i32** %14
%52 = load i32, i32* %51
%53 = call i32 @_mm_xor_si128(i32 %50, i32 %52)
%54 = load i32*, i32** %10
store i32 %53, i32* %54
%55 = load i32*, i32** %11
%56 = load i32, i32* %55
%57 = load i32*, i32** %15
%58 = load i32, i32* %57
%59 = call i32 @_mm_xor_si128(i32 %56, i32 %58)
%60 = load i32*, i32** %11
store i32 %59, i32* %60
%61 = load i32*, i32** %12
%62 = load i32, i32* %61
%63 = load i32*, i32** %16
%64 = load i32, i32* %63
%65 = call i32 @_mm_xor_si128(i32 %62, i32 %64)
%66 = load i32*, i32** %12
store i32 %65, i32* %66
%67 = load i32*, i32** %13
%68 = load i32, i32* %67
%69 = load i32*, i32** %17
%70 = load i32, i32* %69
%71 = call i32 @_mm_xor_si128(i32 %68, i32 %70)
%72 = load i32*, i32** %13
store i32 %71, i32* %72
store i32 0, i32* %19
br label %73
73: ; preds = %178, %9
%74 = load i32, i32* %19
%75 = load i32, i32* %18
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %181
77: ; preds = %73
%78 = load i32, i32* %23
%79 = load i32, i32* %24
%80 = call i32 @_mm_add_epi32(i32 %78, i32 %79)
store i32 %80, i32* %23
%81 = load i32, i32* %26
%82 = load i32, i32* %23
%83 = call i32 @_mm_xor_si128(i32 %81, i32 %82)
store i32 %83, i32* %26
%84 = load i32, i32* %26
%85 = load i32, i32* %21
%86 = call i32 @_mm_shuffle_epi8(i32 %84, i32 %85)
store i32 %86, i32* %26
%87 = load i32, i32* %25
%88 = load i32, i32* %26
%89 = call i32 @_mm_add_epi32(i32 %87, i32 %88)
store i32 %89, i32* %25
%90 = load i32, i32* %24
%91 = load i32, i32* %25
%92 = call i32 @_mm_xor_si128(i32 %90, i32 %91)
store i32 %92, i32* %20
%93 = load i32, i32* %20
%94 = call i32 @_mm_slli_epi32(i32 %93, i32 12)
store i32 %94, i32* %24
%95 = load i32, i32* %20
%96 = call i32 @_mm_srli_epi32(i32 %95, i32 20)
store i32 %96, i32* %20
%97 = load i32, i32* %24
%98 = load i32, i32* %20
%99 = call i32 @_mm_xor_si128(i32 %97, i32 %98)
store i32 %99, i32* %24
%100 = load i32, i32* %23
%101 = load i32, i32* %24
%102 = call i32 @_mm_add_epi32(i32 %100, i32 %101)
store i32 %102, i32* %23
%103 = load i32, i32* %26
%104 = load i32, i32* %23
%105 = call i32 @_mm_xor_si128(i32 %103, i32 %104)
store i32 %105, i32* %26
%106 = load i32, i32* %26
%107 = load i32, i32* %22
%108 = call i32 @_mm_shuffle_epi8(i32 %106, i32 %107)
store i32 %108, i32* %26
%109 = load i32, i32* %25
%110 = load i32, i32* %26
%111 = call i32 @_mm_add_epi32(i32 %109, i32 %110)
store i32 %111, i32* %25
%112 = load i32, i32* %24
%113 = load i32, i32* %25
%114 = call i32 @_mm_xor_si128(i32 %112, i32 %113)
store i32 %114, i32* %20
%115 = load i32, i32* %20
%116 = call i32 @_mm_slli_epi32(i32 %115, i32 7)
store i32 %116, i32* %24
%117 = load i32, i32* %20
%118 = call i32 @_mm_srli_epi32(i32 %117, i32 25)
store i32 %118, i32* %20
%119 = load i32, i32* %24
%120 = load i32, i32* %20
%121 = call i32 @_mm_xor_si128(i32 %119, i32 %120)
store i32 %121, i32* %24
%122 = load i32, i32* %24
%123 = call i32 @_mm_shuffle_epi32(i32 %122, i32 57)
store i32 %123, i32* %24
%124 = load i32, i32* %25
%125 = call i32 @_mm_shuffle_epi32(i32 %124, i32 78)
store i32 %125, i32* %25
%126 = load i32, i32* %26
%127 = call i32 @_mm_shuffle_epi32(i32 %126, i32 147)
store i32 %127, i32* %26
%128 = load i32, i32* %23
%129 = load i32, i32* %24
%130 = call i32 @_mm_add_epi32(i32 %128, i32 %129)
store i32 %130, i32* %23
%131 = load i32, i32* %26
%132 = load i32, i32* %23
%133 = call i32 @_mm_xor_si128(i32 %131, i32 %132)
store i32 %133, i32* %26
%134 = load i32, i32* %26
%135 = load i32, i32* %21
%136 = call i32 @_mm_shuffle_epi8(i32 %134, i32 %135)
store i32 %136, i32* %26
%137 = load i32, i32* %25
%138 = load i32, i32* %26
%139 = call i32 @_mm_add_epi32(i32 %137, i32 %138)
store i32 %139, i32* %25
%140 = load i32, i32* %24
%141 = load i32, i32* %25
%142 = call i32 @_mm_xor_si128(i32 %140, i32 %141)
store i32 %142, i32* %20
%143 = load i32, i32* %20
%144 = call i32 @_mm_slli_epi32(i32 %143, i32 12)
store i32 %144, i32* %24
%145 = load i32, i32* %20
%146 = call i32 @_mm_srli_epi32(i32 %145, i32 20)
store i32 %146, i32* %20
%147 = load i32, i32* %24
%148 = load i32, i32* %20
%149 = call i32 @_mm_xor_si128(i32 %147, i32 %148)
store i32 %149, i32* %24
%150 = load i32, i32* %23
%151 = load i32, i32* %24
%152 = call i32 @_mm_add_epi32(i32 %150, i32 %151)
store i32 %152, i32* %23
%153 = load i32, i32* %26
%154 = load i32, i32* %23
%155 = call i32 @_mm_xor_si128(i32 %153, i32 %154)
store i32 %155, i32* %26
%156 = load i32, i32* %26
%157 = load i32, i32* %22
%158 = call i32 @_mm_shuffle_epi8(i32 %156, i32 %157)
store i32 %158, i32* %26
%159 = load i32, i32* %25
%160 = load i32, i32* %26
%161 = call i32 @_mm_add_epi32(i32 %159, i32 %160)
store i32 %161, i32* %25
%162 = load i32, i32* %24
%163 = load i32, i32* %25
%164 = call i32 @_mm_xor_si128(i32 %162, i32 %163)
store i32 %164, i32* %20
%165 = load i32, i32* %20
%166 = call i32 @_mm_slli_epi32(i32 %165, i32 7)
store i32 %166, i32* %24
%167 = load i32, i32* %20
%168 = call i32 @_mm_srli_epi32(i32 %167, i32 25)
store i32 %168, i32* %20
%169 = load i32, i32* %24
%170 = load i32, i32* %20
%171 = call i32 @_mm_xor_si128(i32 %169, i32 %170)
store i32 %171, i32* %24
%172 = load i32, i32* %24
%173 = call i32 @_mm_shuffle_epi32(i32 %172, i32 147)
store i32 %173, i32* %24
%174 = load i32, i32* %25
%175 = call i32 @_mm_shuffle_epi32(i32 %174, i32 78)
store i32 %175, i32* %25
%176 = load i32, i32* %26
%177 = call i32 @_mm_shuffle_epi32(i32 %176, i32 57)
store i32 %177, i32* %26
br label %178
178: ; preds = %77
%179 = load i32, i32* %19
%180 = add nsw i32 %179, 1
store i32 %180, i32* %19
br label %73
181: ; preds = %73
%182 = load i32*, i32** %10
%183 = load i32, i32* %182
%184 = load i32, i32* %23
%185 = call i32 @_mm_add_epi32(i32 %183, i32 %184)
store i32 %185, i32* %23
%186 = load i32*, i32** %11
%187 = load i32, i32* %186
%188 = load i32, i32* %24
%189 = call i32 @_mm_add_epi32(i32 %187, i32 %188)
store i32 %189, i32* %24
%190 = load i32*, i32** %12
%191 = load i32, i32* %190
%192 = load i32, i32* %25
%193 = call i32 @_mm_add_epi32(i32 %191, i32 %192)
store i32 %193, i32* %25
%194 = load i32*, i32** %13
%195 = load i32, i32* %194
%196 = load i32, i32* %26
%197 = call i32 @_mm_add_epi32(i32 %195, i32 %196)
store i32 %197, i32* %26
%198 = load i32*, i32** %14
%199 = load i32, i32* %198
%200 = load i32*, i32** %10
store i32 %199, i32* %200
%201 = load i32*, i32** %15
%202 = load i32, i32* %201
%203 = load i32*, i32** %11
store i32 %202, i32* %203
%204 = load i32*, i32** %16
%205 = load i32, i32* %204
%206 = load i32*, i32** %12
store i32 %205, i32* %206
%207 = load i32*, i32** %17
%208 = load i32, i32* %207
%209 = load i32*, i32** %13
store i32 %208, i32* %209
%210 = load i32, i32* %23
%211 = load i32*, i32** %14
store i32 %210, i32* %211
%212 = load i32, i32* %24
%213 = load i32*, i32** %15
store i32 %212, i32* %213
%214 = load i32, i32* %25
%215 = load i32*, i32** %16
store i32 %214, i32* %215
%216 = load i32, i32* %26
%217 = load i32*, i32** %17
store i32 %216, i32* %217
ret void
}

LLVM IR (-O2):
define void @xor_chacha_sidm_swap(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5, i32* nocapture %6, i32* nocapture %7, i32 %8) {
%10 = tail call i32 @_mm_setr_epi8(i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5, i32 10, i32 11, i32 8, i32 9, i32 14, i32 15, i32 12, i32 13)
%11 = tail call i32 @_mm_setr_epi8(i32 3, i32 0, i32 1, i32 2, i32 7, i32 4, i32 5, i32 6, i32 11, i32 8, i32 9, i32 10, i32 15, i32 12, i32 13, i32 14)
%12 = load i32, i32* %0
%13 = load i32, i32* %4
%14 = tail call i32 @_mm_xor_si128(i32 %12, i32 %13)
%15 = load i32, i32* %1
%16 = load i32, i32* %5
%17 = tail call i32 @_mm_xor_si128(i32 %15, i32 %16)
%18 = load i32, i32* %2
%19 = load i32, i32* %6
%20 = tail call i32 @_mm_xor_si128(i32 %18, i32 %19)
%21 = load i32, i32* %3
%22 = load i32, i32* %7
%23 = tail call i32 @_mm_xor_si128(i32 %21, i32 %22)
%24 = load i32, i32* %0
%25 = load i32, i32* %4
%26 = tail call i32 @_mm_xor_si128(i32 %24, i32 %25)
store i32 %26, i32* %0
%27 = load i32, i32* %1
%28 = load i32, i32* %5
%29 = tail call i32 @_mm_xor_si128(i32 %27, i32 %28)
store i32 %29, i32* %1
%30 = load i32, i32* %2
%31 = load i32, i32* %6
%32 = tail call i32 @_mm_xor_si128(i32 %30, i32 %31)
store i32 %32, i32* %2
%33 = load i32, i32* %3
%34 = load i32, i32* %7
%35 = tail call i32 @_mm_xor_si128(i32 %33, i32 %34)
store i32 %35, i32* %3
%36 = icmp sgt i32 %8, 0
br i1 %36, label %37, label %83
37: ; preds = %9, %37
%38 = phi i32 [ %80, %37 ], [ %23, %9 ]
%39 = phi i32 [ %79, %37 ], [ %20, %9 ]
%40 = phi i32 [ %78, %37 ], [ %17, %9 ]
%41 = phi i32 [ %70, %37 ], [ %14, %9 ]
%42 = phi i32 [ %81, %37 ], [ 0, %9 ]
%43 = tail call i32 @_mm_add_epi32(i32 %41, i32 %40)
%44 = tail call i32 @_mm_xor_si128(i32 %38, i32 %43)
%45 = tail call i32 @_mm_shuffle_epi8(i32 %44, i32 %10)
%46 = tail call i32 @_mm_add_epi32(i32 %39, i32 %45)
%47 = tail call i32 @_mm_xor_si128(i32 %40, i32 %46)
%48 = tail call i32 @_mm_slli_epi32(i32 %47, i32 12)
%49 = tail call i32 @_mm_srli_epi32(i32 %47, i32 20)
%50 = tail call i32 @_mm_xor_si128(i32 %48, i32 %49)
%51 = tail call i32 @_mm_add_epi32(i32 %43, i32 %50)
%52 = tail call i32 @_mm_xor_si128(i32 %45, i32 %51)
%53 = tail call i32 @_mm_shuffle_epi8(i32 %52, i32 %11)
%54 = tail call i32 @_mm_add_epi32(i32 %46, i32 %53)
%55 = tail call i32 @_mm_xor_si128(i32 %50, i32 %54)
%56 = tail call i32 @_mm_slli_epi32(i32 %55, i32 7)
%57 = tail call i32 @_mm_srli_epi32(i32 %55, i32 25)
%58 = tail call i32 @_mm_xor_si128(i32 %56, i32 %57)
%59 = tail call i32 @_mm_shuffle_epi32(i32 %58, i32 57)
%60 = tail call i32 @_mm_shuffle_epi32(i32 %54, i32 78)
%61 = tail call i32 @_mm_shuffle_epi32(i32 %53, i32 147)
%62 = tail call i32 @_mm_add_epi32(i32 %51, i32 %59)
%63 = tail call i32 @_mm_xor_si128(i32 %61, i32 %62)
%64 = tail call i32 @_mm_shuffle_epi8(i32 %63, i32 %10)
%65 = tail call i32 @_mm_add_epi32(i32 %60, i32 %64)
%66 = tail call i32 @_mm_xor_si128(i32 %59, i32 %65)
%67 = tail call i32 @_mm_slli_epi32(i32 %66, i32 12)
%68 = tail call i32 @_mm_srli_epi32(i32 %66, i32 20)
%69 = tail call i32 @_mm_xor_si128(i32 %67, i32 %68)
%70 = tail call i32 @_mm_add_epi32(i32 %62, i32 %69)
%71 = tail call i32 @_mm_xor_si128(i32 %64, i32 %70)
%72 = tail call i32 @_mm_shuffle_epi8(i32 %71, i32 %11)
%73 = tail call i32 @_mm_add_epi32(i32 %65, i32 %72)
%74 = tail call i32 @_mm_xor_si128(i32 %69, i32 %73)
%75 = tail call i32 @_mm_slli_epi32(i32 %74, i32 7)
%76 = tail call i32 @_mm_srli_epi32(i32 %74, i32 25)
%77 = tail call i32 @_mm_xor_si128(i32 %75, i32 %76)
%78 = tail call i32 @_mm_shuffle_epi32(i32 %77, i32 147)
%79 = tail call i32 @_mm_shuffle_epi32(i32 %73, i32 78)
%80 = tail call i32 @_mm_shuffle_epi32(i32 %72, i32 57)
%81 = add nuw nsw i32 %42, 1
%82 = icmp eq i32 %81, %8
br i1 %82, label %83, label %37
83: ; preds = %37, %9
%84 = phi i32 [ %14, %9 ], [ %70, %37 ]
%85 = phi i32 [ %17, %9 ], [ %78, %37 ]
%86 = phi i32 [ %20, %9 ], [ %79, %37 ]
%87 = phi i32 [ %23, %9 ], [ %80, %37 ]
%88 = load i32, i32* %0
%89 = tail call i32 @_mm_add_epi32(i32 %88, i32 %84)
%90 = load i32, i32* %1
%91 = tail call i32 @_mm_add_epi32(i32 %90, i32 %85)
%92 = load i32, i32* %2
%93 = tail call i32 @_mm_add_epi32(i32 %92, i32 %86)
%94 = load i32, i32* %3
%95 = tail call i32 @_mm_add_epi32(i32 %94, i32 %87)
%96 = load i32, i32* %4
store i32 %96, i32* %0
%97 = load i32, i32* %5
store i32 %97, i32* %1
%98 = load i32, i32* %6
store i32 %98, i32* %2
%99 = load i32, i32* %7
store i32 %99, i32* %3
store i32 %89, i32* %4
store i32 %91, i32* %5
store i32 %93, i32* %6
store i32 %95, i32* %7
ret void
}