#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];
  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    $0x40,%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,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%edi
mov    $0x8,%esi
call   10a0 <_mm_slli_si128@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
mov    $0x8,%esi
call   1040 <_mm_srli_si128@plt>
mov    -0x40(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_or_si128@plt>
mov    -0x3c(%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,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
mov    $0x8,%esi
call   10a0 <_mm_slli_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%edi
mov    $0x8,%esi
call   1040 <_mm_srli_si128@plt>
mov    -0x38(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_or_si128@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%esi
call   1090 <_mm_and_si128@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x1c(%rax),%esi
call   1090 <_mm_and_si128@plt>
mov    -0x2c(%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    $0x40,%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]
store i32* %0, i32** %4
store i32* %1, i32** %5
store [2 x i32]* %2, [2 x i32]** %6
%9 = load i32*, i32** %5
%10 = call i32 @_mm_load_si128(i32* %9)
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 %10, i32* %11
%12 = load i32*, i32** %5
%13 = getelementptr inbounds i32, i32* %12, i64 16
%14 = call i32 @_mm_load_si128(i32* %13)
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
store i32 %14, i32* %15
%16 = load [2 x i32]*, [2 x i32]** %6
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0, i64 0
%19 = load i32, i32* %18
%20 = load [2 x i32]*, [2 x i32]** %6
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %20, i64 1
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 1
%23 = load i32, i32* %22
%24 = call i32 @_mm_slli_si128(i32 %23, i32 8)
%25 = load [2 x i32]*, [2 x i32]** %6
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %25, i64 1
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %26, i64 0, i64 0
%28 = load i32, i32* %27
%29 = call i32 @_mm_srli_si128(i32 %28, i32 8)
%30 = call i32 @_mm_or_si128(i32 %24, i32 %29)
%31 = call i32 @_mm_xor_si128(i32 %19, i32 %30)
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %31, i32* %32
%33 = load [2 x i32]*, [2 x i32]** %6
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %33, i64 0
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %34, i64 0, i64 1
%36 = load i32, i32* %35
%37 = load [2 x i32]*, [2 x i32]** %6
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %37, i64 1
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %38, i64 0, i64 0
%40 = load i32, i32* %39
%41 = call i32 @_mm_slli_si128(i32 %40, i32 8)
%42 = load [2 x i32]*, [2 x i32]** %6
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %42, i64 1
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %43, i64 0, i64 1
%45 = load i32, i32* %44
%46 = call i32 @_mm_srli_si128(i32 %45, i32 8)
%47 = call i32 @_mm_or_si128(i32 %41, i32 %46)
%48 = call i32 @_mm_xor_si128(i32 %36, i32 %47)
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %48, i32* %49
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%51 = load i32, i32* %50
%52 = load [2 x i32]*, [2 x i32]** %6
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %52, i64 2
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %53, i64 0, i64 0
%55 = load i32, i32* %54
%56 = load [2 x i32]*, [2 x i32]** %6
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %56, i64 3
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %57, i64 0, i64 0
%59 = load i32, i32* %58
%60 = call i32 @_mm_and_si128(i32 %55, i32 %59)
%61 = call i32 @_mm_xor_si128(i32 %51, i32 %60)
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %61, i32* %62
%63 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%64 = load i32, i32* %63
%65 = load [2 x i32]*, [2 x i32]** %6
%66 = getelementptr inbounds [2 x i32], [2 x i32]* %65, i64 2
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %66, i64 0, i64 1
%68 = load i32, i32* %67
%69 = load [2 x i32]*, [2 x i32]** %6
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %69, i64 3
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %70, i64 0, i64 1
%72 = load i32, i32* %71
%73 = call i32 @_mm_and_si128(i32 %68, i32 %72)
%74 = call i32 @_mm_xor_si128(i32 %64, i32 %73)
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %74, i32* %75
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%77 = load i32, i32* %76
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%79 = load i32, i32* %78
%80 = call i32 @_mm_xor_si128(i32 %77, i32 %79)
%81 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 %80, i32* %81
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%83 = load i32, i32* %82
%84 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%85 = load i32, i32* %84
%86 = call i32 @_mm_xor_si128(i32 %83, i32 %85)
%87 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
store i32 %86, i32* %87
%88 = load i32*, i32** %4
%89 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%90 = load i32, i32* %89
%91 = call i32 @_mm_store_si128(i32* %88, i32 %90)
%92 = load i32*, i32** %4
%93 = getelementptr inbounds i32, i32* %92, i64 16
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%95 = load i32, i32* %94
%96 = call i32 @_mm_store_si128(i32* %93, i32 %95)
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%98 = load [2 x i32]*, [2 x i32]** %6
%99 = bitcast [2 x i32]* %98 to i32**
%100 = call i32 @morus_stateupdate(i32* %97, i32** %99)
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
}