#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*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_aesdec_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_aesdeclast_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_aesenc_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_aesenclast_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i decrypt_block(__m128i p, __m128i *x, __m128i *y, __m128i *k,
                      __m128i *lt, __m128i *lb) {
  *y = _mm_xor_si128(*y, p);
  p = _mm_xor_si128(*y, k[0]);
  *y = _mm_xor_si128(*y, lb[0]);
  *x = _mm_xor_si128(*x, lt[0]);
  unsigned j;
  for (j = 1; j < 10; ++j) {
    p = _mm_aesdec_si128(p, k[j]);
    *x = _mm_aesenc_si128(*x, lt[j]);
    *y = _mm_aesenc_si128(*y, lb[j]);
  }
  p = _mm_aesdeclast_si128(p, k[10]);
  *x = _mm_aesenclast_si128(*x, lt[10]);
  *y = _mm_aesenclast_si128(*y, lb[10]);
  p = _mm_xor_si128(p, *x);
  *x = _mm_xor_si128(*x, p);
  return p;
}


x86 assembly (clang, -O0):
<decrypt_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jae    1239 <decrypt_block+0xe9>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1040 <_mm_aesdec_si128@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1050 <_mm_aesenc_si128@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1050 <_mm_aesenc_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d2 <decrypt_block+0x82>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    0x28(%rax),%esi
call   1070 <_mm_aesdeclast_si128@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    0x28(%rax),%esi
call   1030 <_mm_aesenclast_si128@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    0x28(%rax),%esi
call   1030 <_mm_aesenclast_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8,%r13
mov    %rcx,%rbp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%esi
mov    (%rdx),%edi
call   1060 <_mm_xor_si128@plt>
mov    %eax,(%rbx)
mov    %rbp,%r12
mov    0x0(%rbp),%esi
mov    %eax,%edi
call   1060 <_mm_xor_si128@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
mov    %r15,(%rsp)
mov    (%r15),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,(%rbx)
mov    (%r14),%edi
mov    0x0(%r13),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,(%r14)
mov    $0x1,%r15d
nopl   0x0(%rax)
mov    (%r12,%r15,4),%esi
mov    %ebp,%edi
call   1040 <_mm_aesdec_si128@plt>
mov    %eax,%ebp
mov    (%r14),%edi
mov    0x0(%r13,%r15,4),%esi
call   1050 <_mm_aesenc_si128@plt>
mov    %eax,(%r14)
mov    (%rbx),%edi
mov    (%rsp),%rax
mov    (%rax,%r15,4),%esi
call   1050 <_mm_aesenc_si128@plt>
mov    %eax,(%rbx)
add    $0x1,%r15
cmp    $0xa,%r15
jne    11b0 <decrypt_block+0x60>
mov    0x28(%r12),%esi
mov    %ebp,%edi
call   1070 <_mm_aesdeclast_si128@plt>
mov    %eax,%ebp
mov    (%r14),%edi
mov    0x28(%r13),%esi
call   1030 <_mm_aesenclast_si128@plt>
mov    %eax,(%r14)
mov    (%rbx),%edi
mov    (%rsp),%rax
mov    0x28(%rax),%esi
call   1030 <_mm_aesenclast_si128@plt>
mov    %eax,(%rbx)
mov    (%r14),%esi
mov    %ebp,%edi
call   1060 <_mm_xor_si128@plt>
mov    %eax,%ebx
mov    (%r14),%edi
mov    %eax,%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,(%r14)
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @decrypt_block(i32 %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5) {
%7 = load i32, i32* %2
%8 = tail call i32 @_mm_xor_si128(i32 %7, i32 %0)
store i32 %8, i32* %2
%9 = load i32, i32* %3
%10 = tail call i32 @_mm_xor_si128(i32 %8, i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %5
%13 = tail call i32 @_mm_xor_si128(i32 %11, i32 %12)
store i32 %13, i32* %2
%14 = load i32, i32* %1
%15 = load i32, i32* %4
%16 = tail call i32 @_mm_xor_si128(i32 %14, i32 %15)
store i32 %16, i32* %1
br label %17
17: ; preds = %6, %17
%18 = phi i64 [ 1, %6 ], [ %31, %17 ]
%19 = phi i32 [ %10, %6 ], [ %22, %17 ]
%20 = getelementptr inbounds i32, i32* %3, i64 %18
%21 = load i32, i32* %20
%22 = tail call i32 @_mm_aesdec_si128(i32 %19, i32 %21)
%23 = load i32, i32* %1
%24 = getelementptr inbounds i32, i32* %4, i64 %18
%25 = load i32, i32* %24
%26 = tail call i32 @_mm_aesenc_si128(i32 %23, i32 %25)
store i32 %26, i32* %1
%27 = load i32, i32* %2
%28 = getelementptr inbounds i32, i32* %5, i64 %18
%29 = load i32, i32* %28
%30 = tail call i32 @_mm_aesenc_si128(i32 %27, i32 %29)
store i32 %30, i32* %2
%31 = add nuw nsw i64 %18, 1
%32 = icmp eq i64 %31, 10
br i1 %32, label %33, label %17
33: ; preds = %17
%34 = getelementptr inbounds i32, i32* %3, i64 10
%35 = load i32, i32* %34
%36 = tail call i32 @_mm_aesdeclast_si128(i32 %22, i32 %35)
%37 = load i32, i32* %1
%38 = getelementptr inbounds i32, i32* %4, i64 10
%39 = load i32, i32* %38
%40 = tail call i32 @_mm_aesenclast_si128(i32 %37, i32 %39)
store i32 %40, i32* %1
%41 = load i32, i32* %2
%42 = getelementptr inbounds i32, i32* %5, i64 10
%43 = load i32, i32* %42
%44 = tail call i32 @_mm_aesenclast_si128(i32 %41, i32 %43)
store i32 %44, i32* %2
%45 = load i32, i32* %1
%46 = tail call i32 @_mm_xor_si128(i32 %36, i32 %45)
%47 = load i32, i32* %1
%48 = tail call i32 @_mm_xor_si128(i32 %47, i32 %46)
store i32 %48, i32* %1
ret i32 %46
}