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

/* Variables and functions */
int /*<<< orphan*/ _mm_and_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_load_si128(int /*<<< orphan*/ *);
int /*<<< orphan*/ _mm_or_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_slli_si128(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_srli_si128(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_store_si128(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ morus_stateupdate(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ **);
void morus_dec_aut_step(uint8_t *plaintextblock, const uint8_t *ciphertextblock,
                        __m128i (*state)[2]) {
  __m128i keystream[2];
  __m128i msgblk[2];
  __m128i t;
  msgblk[0] = _mm_load_si128((__m128i *)ciphertextblock);
  msgblk[1] = _mm_load_si128((__m128i *)(ciphertextblock + 16));
  keystream[0] = _mm_xor_si128(
      (state[0][0]), (_mm_or_si128((_mm_slli_si128(state[1][1], 8)),
                                   (_mm_srli_si128(state[1][0], 8)))));
  keystream[1] = _mm_xor_si128(
      (state[0][1]), (_mm_or_si128((_mm_slli_si128(state[1][0], 8)),
                                   (_mm_srli_si128(state[1][1], 8)))));
  keystream[0] = _mm_xor_si128((keystream[0]),
                               (_mm_and_si128((state[2][0]), (state[3][0]))));
  keystream[1] = _mm_xor_si128((keystream[1]),
                               (_mm_and_si128((state[2][1]), (state[3][1]))));
  msgblk[0] = _mm_xor_si128((keystream[0]), (msgblk[0]));
  msgblk[1] = _mm_xor_si128((keystream[1]), (msgblk[1]));
  _mm_store_si128((__m128i *)plaintextblock, msgblk[0]);
  _mm_store_si128((__m128i *)(plaintextblock + 16), msgblk[1]);
  morus_stateupdate(msgblk, state);
}


x86 assembly (clang, -O0):
<morus_dec_aut_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x40,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%edi
mov    $0x8,%esi
call   10a0 <_mm_slli_si128@plt>
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
mov    $0x8,%esi
call   1040 <_mm_srli_si128@plt>
mov    -0x44(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_or_si128@plt>
mov    -0x40(%rbp),%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
mov    $0x8,%esi
call   10a0 <_mm_slli_si128@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%edi
mov    $0x8,%esi
call   1040 <_mm_srli_si128@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_or_si128@plt>
mov    -0x38(%rbp),%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%esi
call   1090 <_mm_and_si128@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x1c(%rax),%esi
call   1090 <_mm_and_si128@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1050 <_mm_store_si128@plt>
mov    -0x8(%rbp),%rdi
add    $0x40,%rdi
mov    -0x24(%rbp),%esi
call   1050 <_mm_store_si128@plt>
lea    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <morus_stateupdate@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<morus_dec_aut_step>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,%ebx
add    $0x40,%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0xc(%rsp)
mov    (%r12),%r13d
mov    0xc(%r12),%edi
mov    $0x8,%esi
call   10a0 <_mm_slli_si128@plt>
mov    %eax,%ebp
mov    0x8(%r12),%edi
mov    $0x8,%esi
call   1040 <_mm_srli_si128@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <_mm_or_si128@plt>
mov    %r13d,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%r13d
mov    0x4(%r12),%ebp
mov    0x8(%r12),%edi
mov    $0x8,%esi
call   10a0 <_mm_slli_si128@plt>
mov    %eax,%r15d
mov    0xc(%r12),%edi
mov    $0x8,%esi
call   1040 <_mm_srli_si128@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1060 <_mm_or_si128@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%r15d
mov    0x10(%r12),%edi
mov    0x18(%r12),%esi
call   1090 <_mm_and_si128@plt>
mov    %r13d,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%r13d
mov    0x14(%r12),%edi
mov    0x1c(%r12),%esi
call   1090 <_mm_and_si128@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%r15d
mov    %r13d,%edi
mov    %ebx,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    %eax,0x10(%rsp)
mov    %r15d,%edi
mov    0xc(%rsp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebx
mov    %eax,0x14(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <_mm_store_si128@plt>
add    $0x40,%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <_mm_store_si128@plt>
lea    0x10(%rsp),%rdi
mov    %r12,%rsi
call   1080 <morus_stateupdate@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @morus_dec_aut_step(i32* %0, i32* %1, [2 x i32]* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [2 x i32]*
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store [2 x i32]* %2, [2 x i32]** %6
%10 = load i32*, i32** %5
%11 = call i32 @_mm_load_si128(i32* %10)
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 %11, i32* %12
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 16
%15 = call i32 @_mm_load_si128(i32* %14)
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
store i32 %15, i32* %16
%17 = load [2 x i32]*, [2 x i32]** %6
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 0
%20 = load i32, i32* %19
%21 = load [2 x i32]*, [2 x i32]** %6
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 1
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 1
%24 = load i32, i32* %23
%25 = call i32 @_mm_slli_si128(i32 %24, i32 8)
%26 = load [2 x i32]*, [2 x i32]** %6
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %26, i64 1
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %27, i64 0, i64 0
%29 = load i32, i32* %28
%30 = call i32 @_mm_srli_si128(i32 %29, i32 8)
%31 = call i32 @_mm_or_si128(i32 %25, i32 %30)
%32 = call i32 @_mm_xor_si128(i32 %20, i32 %31)
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %32, i32* %33
%34 = load [2 x i32]*, [2 x i32]** %6
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %34, i64 0
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %35, i64 0, i64 1
%37 = load i32, i32* %36
%38 = load [2 x i32]*, [2 x i32]** %6
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %38, i64 1
%40 = getelementptr inbounds [2 x i32], [2 x i32]* %39, i64 0, i64 0
%41 = load i32, i32* %40
%42 = call i32 @_mm_slli_si128(i32 %41, i32 8)
%43 = load [2 x i32]*, [2 x i32]** %6
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %43, i64 1
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %44, i64 0, i64 1
%46 = load i32, i32* %45
%47 = call i32 @_mm_srli_si128(i32 %46, i32 8)
%48 = call i32 @_mm_or_si128(i32 %42, i32 %47)
%49 = call i32 @_mm_xor_si128(i32 %37, i32 %48)
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %49, i32* %50
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%52 = load i32, i32* %51
%53 = load [2 x i32]*, [2 x i32]** %6
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %53, i64 2
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %54, i64 0, i64 0
%56 = load i32, i32* %55
%57 = load [2 x i32]*, [2 x i32]** %6
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %57, i64 3
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %58, i64 0, i64 0
%60 = load i32, i32* %59
%61 = call i32 @_mm_and_si128(i32 %56, i32 %60)
%62 = call i32 @_mm_xor_si128(i32 %52, i32 %61)
%63 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %62, i32* %63
%64 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%65 = load i32, i32* %64
%66 = load [2 x i32]*, [2 x i32]** %6
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %66, i64 2
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %67, i64 0, i64 1
%69 = load i32, i32* %68
%70 = load [2 x i32]*, [2 x i32]** %6
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %70, i64 3
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %71, i64 0, i64 1
%73 = load i32, i32* %72
%74 = call i32 @_mm_and_si128(i32 %69, i32 %73)
%75 = call i32 @_mm_xor_si128(i32 %65, i32 %74)
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %75, i32* %76
%77 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%78 = load i32, i32* %77
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%80 = load i32, i32* %79
%81 = call i32 @_mm_xor_si128(i32 %78, i32 %80)
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 %81, i32* %82
%83 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%84 = load i32, i32* %83
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%86 = load i32, i32* %85
%87 = call i32 @_mm_xor_si128(i32 %84, i32 %86)
%88 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
store i32 %87, i32* %88
%89 = load i32*, i32** %4
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%91 = load i32, i32* %90
%92 = call i32 @_mm_store_si128(i32* %89, i32 %91)
%93 = load i32*, i32** %4
%94 = getelementptr inbounds i32, i32* %93, i64 16
%95 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%96 = load i32, i32* %95
%97 = call i32 @_mm_store_si128(i32* %94, i32 %96)
%98 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%99 = load [2 x i32]*, [2 x i32]** %6
%100 = bitcast [2 x i32]* %99 to i32**
%101 = call i32 @morus_stateupdate(i32* %98, i32** %100)
ret void
}

LLVM IR (-O2):
define void @morus_dec_aut_step(i32* %0, i32* %1, [2 x i32]* %2) {
%4 = alloca [2 x i32]
%5 = bitcast [2 x i32]* %4 to i8*
%6 = tail call i32 @_mm_load_si128(i32* %1)
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%8 = getelementptr inbounds i32, i32* %1, i64 16
%9 = tail call i32 @_mm_load_si128(i32* %8)
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %11
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 1, i64 1
%14 = load i32, i32* %13
%15 = tail call i32 @_mm_slli_si128(i32 %14, i32 8)
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 1, i64 0
%17 = load i32, i32* %16
%18 = tail call i32 @_mm_srli_si128(i32 %17, i32 8)
%19 = tail call i32 @_mm_or_si128(i32 %15, i32 %18)
%20 = tail call i32 @_mm_xor_si128(i32 %12, i32 %19)
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%22 = load i32, i32* %21
%23 = load i32, i32* %16
%24 = tail call i32 @_mm_slli_si128(i32 %23, i32 8)
%25 = load i32, i32* %13
%26 = tail call i32 @_mm_srli_si128(i32 %25, i32 8)
%27 = tail call i32 @_mm_or_si128(i32 %24, i32 %26)
%28 = tail call i32 @_mm_xor_si128(i32 %22, i32 %27)
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 2, i64 0
%30 = load i32, i32* %29
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 3, i64 0
%32 = load i32, i32* %31
%33 = tail call i32 @_mm_and_si128(i32 %30, i32 %32)
%34 = tail call i32 @_mm_xor_si128(i32 %20, i32 %33)
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 2, i64 1
%36 = load i32, i32* %35
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 3, i64 1
%38 = load i32, i32* %37
%39 = tail call i32 @_mm_and_si128(i32 %36, i32 %38)
%40 = tail call i32 @_mm_xor_si128(i32 %28, i32 %39)
%41 = tail call i32 @_mm_xor_si128(i32 %34, i32 %6)
store i32 %41, i32* %7
%42 = tail call i32 @_mm_xor_si128(i32 %40, i32 %9)
store i32 %42, i32* %10
%43 = tail call i32 @_mm_store_si128(i32* %0, i32 %41)
%44 = getelementptr inbounds i32, i32* %0, i64 16
%45 = tail call i32 @_mm_store_si128(i32* %44, i32 %42)
%46 = bitcast [2 x i32]* %2 to i32**
%47 = call i32 @morus_stateupdate(i32* %7, i32** %46)
ret void
}