#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ rrr_SLK(int *, int *);
int /*<<< orphan*/ rrr_sbox(int *);
void rrr_enc_dec_round(uint8_t *block, uint8_t *roundKey, uint8_t round) {
  uint8_t i, temp[4];
  for (i = 0; i < 4; i++)
    temp[i] = block[i];
  rrr_SLK(block, roundKey);
  rrr_SLK(block, roundKey + 4);
  block[3] ^= round;
  rrr_SLK(block, roundKey + 8);
  rrr_sbox(block);
  for (i = 0; i < 4; i++)
    block[i] ^= block[i + 4];
  for (i = 0; i < 4; i++)
    block[i + 4] = temp[i];
}


x86 assembly (clang, -O0):
<rrr_enc_dec_round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    1165 <rrr_enc_dec_round+0x45>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <rrr_enc_dec_round+0x1a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <rrr_SLK@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1040 <rrr_SLK@plt>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
xor    0xc(%rax),%ecx
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x20,%rsi
call   1040 <rrr_SLK@plt>
mov    -0x8(%rbp),%rdi
call   1030 <rrr_sbox@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    11e7 <rrr_enc_dec_round+0xc7>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b1 <rrr_enc_dec_round+0x91>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    121e <rrr_enc_dec_round+0xfe>
movslq -0x18(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ee <rrr_enc_dec_round+0xce>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rrr_enc_dec_round>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
movups (%rdi),%xmm0
movaps %xmm0,(%rsp)
call   1040 <rrr_SLK@plt>
lea    0x10(%rbp),%rsi
mov    %rbx,%rdi
call   1040 <rrr_SLK@plt>
xor    %r14d,0xc(%rbx)
add    $0x20,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <rrr_SLK@plt>
mov    %rbx,%rdi
call   1030 <rrr_sbox@plt>
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm1
xorps  %xmm0,%xmm1
movups %xmm1,(%rbx)
movaps (%rsp),%xmm0
movups %xmm0,0x10(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @rrr_enc_dec_round(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4 x i32]
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %21, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32*, i32** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 %19
store i32 %17, i32* %20
br label %21
21: ; preds = %12
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %9
24: ; preds = %9
%25 = load i32*, i32** %4
%26 = load i32*, i32** %5
%27 = call i32 @rrr_SLK(i32* %25, i32* %26)
%28 = load i32*, i32** %4
%29 = load i32*, i32** %5
%30 = getelementptr inbounds i32, i32* %29, i64 4
%31 = call i32 @rrr_SLK(i32* %28, i32* %30)
%32 = load i32, i32* %6
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 3
%35 = load i32, i32* %34
%36 = xor i32 %35, %32
store i32 %36, i32* %34
%37 = load i32*, i32** %4
%38 = load i32*, i32** %5
%39 = getelementptr inbounds i32, i32* %38, i64 8
%40 = call i32 @rrr_SLK(i32* %37, i32* %39)
%41 = load i32*, i32** %4
%42 = call i32 @rrr_sbox(i32* %41)
store i32 0, i32* %7
br label %43
43: ; preds = %59, %24
%44 = load i32, i32* %7
%45 = icmp slt i32 %44, 4
br i1 %45, label %46, label %62
46: ; preds = %43
%47 = load i32*, i32** %4
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 4
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %47, i64 %50
%52 = load i32, i32* %51
%53 = load i32*, i32** %4
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %53, i64 %55
%57 = load i32, i32* %56
%58 = xor i32 %57, %52
store i32 %58, i32* %56
br label %59
59: ; preds = %46
%60 = load i32, i32* %7
%61 = add nsw i32 %60, 1
store i32 %61, i32* %7
br label %43
62: ; preds = %43
store i32 0, i32* %7
br label %63
63: ; preds = %76, %62
%64 = load i32, i32* %7
%65 = icmp slt i32 %64, 4
br i1 %65, label %66, label %79
66: ; preds = %63
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = load i32*, i32** %4
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 4
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %71, i64 %74
store i32 %70, i32* %75
br label %76
76: ; preds = %66
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 1
store i32 %78, i32* %7
br label %63
79: ; preds = %63
ret void
}

LLVM IR (-O2):
define void @rrr_enc_dec_round(i32* %0, i32* %1, i32 %2) {
%4 = bitcast i32* %0 to i8*
%5 = alloca [4 x i32]
%6 = bitcast [4 x i32]* %5 to i8*
%7 = tail call i32 @rrr_SLK(i32* %0, i32* %1)
%8 = getelementptr inbounds i32, i32* %1, i64 4
%9 = tail call i32 @rrr_SLK(i32* %0, i32* %8)
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = load i32, i32* %10
%12 = xor i32 %11, %2
store i32 %12, i32* %10
%13 = getelementptr inbounds i32, i32* %1, i64 8
%14 = tail call i32 @rrr_SLK(i32* %0, i32* %13)
%15 = tail call i32 @rrr_sbox(i32* %0)
%16 = getelementptr i32, i32* %0, i64 4
%17 = bitcast i32* %16 to <4 x i32>*
%18 = load <4 x i32>, <4 x i32>* %17
%19 = bitcast i32* %0 to <4 x i32>*
%20 = load <4 x i32>, <4 x i32>* %19
%21 = xor <4 x i32> %20, %18
%22 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> %21, <4 x i32>* %22
%23 = bitcast i32* %16 to i8*
ret void
}