#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 READ_ROUND_KEY_BYTE(int);
int /*<<< orphan*/ rrr_enc_dec_round(int *, int *, int);
void Encrypt(uint8_t *block, uint8_t *roundKeys) {
  uint8_t i, temp[4] = {0}, j = 4;
  for (i = 0; i < 4; i++)
    block[i] ^= READ_ROUND_KEY_BYTE(roundKeys[i]);
  for (i = 10; i > 0; i--) {
    rrr_enc_dec_round(block, roundKeys + j, i);
    j += 12;
  }
  for (i = 0; i < 4; i++)
    temp[i] = block[i];
  for (i = 0; i < 4; i++)
    block[i] = block[i + 4] ^ READ_ROUND_KEY_BYTE(roundKeys[i + 4]);
  for (i = 0; i < 4; i++)
    block[i + 4] = temp[i];
}


x86 assembly (clang, -O0):
<Encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movl   $0x4,-0x34(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1196 <Encrypt+0x66>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <READ_ROUND_KEY_BYTE@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115e <Encrypt+0x2e>
movl   $0xa,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11d9 <Encrypt+0xa9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
call   1030 <rrr_enc_dec_round@plt>
mov    -0x34(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    119d <Encrypt+0x6d>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    120b <Encrypt+0xdb>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e0 <Encrypt+0xb0>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1262 <Encrypt+0x132>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <READ_ROUND_KEY_BYTE@plt>
mov    -0x38(%rbp),%edx
xor    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1212 <Encrypt+0xe2>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1299 <Encrypt+0x169>
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1269 <Encrypt+0x139>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Encrypt>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,(%rbx)
mov    0x4(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0x4(%rbx)
mov    0x8(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0x8(%rbx)
mov    0xc(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0xc(%rbx)
lea    0x10(%r14),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x40(%r14),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x70(%r14),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0xa0(%r14),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0xd0(%r14),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x100(%r14),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x130(%r14),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x160(%r14),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x190(%r14),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x1c0(%r14),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <rrr_enc_dec_round@plt>
movups (%rbx),%xmm0
movaps %xmm0,(%rsp)
mov    0x10(%rbx),%ebp
mov    0x10(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,(%rbx)
mov    0x14(%rbx),%ebp
mov    0x14(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x4(%rbx)
mov    0x18(%rbx),%ebp
mov    0x18(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x8(%rbx)
mov    0x1c(%rbx),%ebp
mov    0x1c(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0xc(%rbx)
movaps (%rsp),%xmm0
movups %xmm0,0x10(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @Encrypt(i32* %0, i32* %1) {
%3 = bitcast i32* %0 to i8*
%4 = alloca [4 x i32]
%5 = bitcast [4 x i32]* %4 to i8*
%6 = load i32, i32* %1
%7 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %6)
%8 = load i32, i32* %0
%9 = xor i32 %8, %7
store i32 %9, i32* %0
%10 = getelementptr inbounds i32, i32* %1, i64 1
%11 = load i32, i32* %10
%12 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %11)
%13 = getelementptr inbounds i32, i32* %0, i64 1
%14 = load i32, i32* %13
%15 = xor i32 %14, %12
store i32 %15, i32* %13
%16 = getelementptr inbounds i32, i32* %1, i64 2
%17 = load i32, i32* %16
%18 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %17)
%19 = getelementptr inbounds i32, i32* %0, i64 2
%20 = load i32, i32* %19
%21 = xor i32 %20, %18
store i32 %21, i32* %19
%22 = getelementptr inbounds i32, i32* %1, i64 3
%23 = load i32, i32* %22
%24 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %23)
%25 = getelementptr inbounds i32, i32* %0, i64 3
%26 = load i32, i32* %25
%27 = xor i32 %26, %24
store i32 %27, i32* %25
%28 = getelementptr inbounds i32, i32* %1, i64 4
%29 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %28, i32 10)
%30 = getelementptr inbounds i32, i32* %1, i64 16
%31 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %30, i32 9)
%32 = getelementptr inbounds i32, i32* %1, i64 28
%33 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %32, i32 8)
%34 = getelementptr inbounds i32, i32* %1, i64 40
%35 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %34, i32 7)
%36 = getelementptr inbounds i32, i32* %1, i64 52
%37 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %36, i32 6)
%38 = getelementptr inbounds i32, i32* %1, i64 64
%39 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %38, i32 5)
%40 = getelementptr inbounds i32, i32* %1, i64 76
%41 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %40, i32 4)
%42 = getelementptr inbounds i32, i32* %1, i64 88
%43 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %42, i32 3)
%44 = getelementptr inbounds i32, i32* %1, i64 100
%45 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %44, i32 2)
%46 = getelementptr inbounds i32, i32* %1, i64 112
%47 = tail call i32 @rrr_enc_dec_round(i32* %0, i32* %46, i32 1)
%48 = getelementptr i32, i32* %0, i64 4
%49 = load i32, i32* %48
%50 = load i32, i32* %28
%51 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %50)
%52 = xor i32 %51, %49
store i32 %52, i32* %0
%53 = getelementptr inbounds i32, i32* %0, i64 5
%54 = load i32, i32* %53
%55 = getelementptr inbounds i32, i32* %1, i64 5
%56 = load i32, i32* %55
%57 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %56)
%58 = xor i32 %57, %54
store i32 %58, i32* %13
%59 = getelementptr inbounds i32, i32* %0, i64 6
%60 = load i32, i32* %59
%61 = getelementptr inbounds i32, i32* %1, i64 6
%62 = load i32, i32* %61
%63 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %62)
%64 = xor i32 %63, %60
store i32 %64, i32* %19
%65 = getelementptr inbounds i32, i32* %0, i64 7
%66 = load i32, i32* %65
%67 = getelementptr inbounds i32, i32* %1, i64 7
%68 = load i32, i32* %67
%69 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %68)
%70 = xor i32 %69, %66
store i32 %70, i32* %25
%71 = bitcast i32* %48 to i8*
ret void
}