#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 Decrypt(uint8_t *block, uint8_t *roundKeys) {
  uint8_t i, j = 0, temp[4] = {0};
  for (i = 0; i < 4; i++)
    block[i] ^= READ_ROUND_KEY_BYTE(roundKeys[i + 20]);
  for (i = 1; i <= 12; 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 + 8]);
  for (i = 0; i < 4; i++)
    block[i + 4] = temp[i];
}


x86 assembly (clang, -O0):
<Decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    119b <Decrypt+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x14,%ecx
movslq %ecx,%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 <Decrypt+0x2e>
movl   $0x1,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jg     11de <Decrypt+0xae>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
call   1030 <rrr_enc_dec_round@plt>
mov    -0x18(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a2 <Decrypt+0x72>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1210 <Decrypt+0xe0>
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    11e5 <Decrypt+0xb5>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1267 <Decrypt+0x137>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x8,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <READ_ROUND_KEY_BYTE@plt>
mov    -0x34(%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    1217 <Decrypt+0xe7>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    129e <Decrypt+0x16e>
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    126e <Decrypt+0x13e>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Decrypt>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x50(%rsi),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,(%rbx)
mov    0x54(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0x4(%rbx)
mov    0x58(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0x8(%rbx)
mov    0x5c(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0xc(%rbx)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x30(%r14),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x60(%r14),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x90(%r14),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0xc0(%r14),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0xf0(%r14),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x120(%r14),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x150(%r14),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x180(%r14),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x1b0(%r14),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x1e0(%r14),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
call   1030 <rrr_enc_dec_round@plt>
lea    0x210(%r14),%rsi
mov    %rbx,%rdi
mov    $0xc,%edx
call   1030 <rrr_enc_dec_round@plt>
movups (%rbx),%xmm0
movaps %xmm0,(%rsp)
mov    0x10(%rbx),%ebp
mov    0x20(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,(%rbx)
mov    0x14(%rbx),%ebp
mov    0x24(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x4(%rbx)
mov    0x18(%rbx),%ebp
mov    0x28(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x8(%rbx)
mov    0x1c(%rbx),%ebp
mov    0x2c(%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 @Decrypt(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i32]
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %6
%8 = bitcast [4 x i32]* %7 to i8*
store i32 0, i32* %5
br label %9
9: ; preds = %26, %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 20
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @READ_ROUND_KEY_BYTE(i32 %18)
%20 = load i32*, i32** %3
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = xor i32 %24, %19
store i32 %25, i32* %23
br label %26
26: ; preds = %12
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %9
29: ; preds = %9
store i32 1, i32* %5
br label %30
30: ; preds = %43, %29
%31 = load i32, i32* %5
%32 = icmp sle i32 %31, 12
br i1 %32, label %33, label %46
33: ; preds = %30
%34 = load i32*, i32** %3
%35 = load i32*, i32** %4
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = load i32, i32* %5
%40 = call i32 @rrr_enc_dec_round(i32* %34, i32* %38, i32 %39)
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 12
store i32 %42, i32* %6
br label %43
43: ; preds = %33
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %30
46: ; preds = %30
store i32 0, i32* %5
br label %47
47: ; preds = %59, %46
%48 = load i32, i32* %5
%49 = icmp slt i32 %48, 4
br i1 %49, label %50, label %62
50: ; preds = %47
%51 = load i32*, i32** %3
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
%55 = load i32, i32* %54
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %57
store i32 %55, i32* %58
br label %59
59: ; preds = %50
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
br label %47
62: ; preds = %47
store i32 0, i32* %5
br label %63
63: ; preds = %85, %62
%64 = load i32, i32* %5
%65 = icmp slt i32 %64, 4
br i1 %65, label %66, label %88
66: ; preds = %63
%67 = load i32*, i32** %3
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 4
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i32, i32* %67, i64 %70
%72 = load i32, i32* %71
%73 = load i32*, i32** %4
%74 = load i32, i32* %5
%75 = add nsw i32 %74, 8
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %73, i64 %76
%78 = load i32, i32* %77
%79 = call i32 @READ_ROUND_KEY_BYTE(i32 %78)
%80 = xor i32 %72, %79
%81 = load i32*, i32** %3
%82 = load i32, i32* %5
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i32, i32* %81, i64 %83
store i32 %80, i32* %84
br label %85
85: ; preds = %66
%86 = load i32, i32* %5
%87 = add nsw i32 %86, 1
store i32 %87, i32* %5
br label %63
88: ; preds = %63
store i32 0, i32* %5
br label %89
89: ; preds = %102, %88
%90 = load i32, i32* %5
%91 = icmp slt i32 %90, 4
br i1 %91, label %92, label %105
92: ; preds = %89
%93 = load i32, i32* %5
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %94
%96 = load i32, i32* %95
%97 = load i32*, i32** %3
%98 = load i32, i32* %5
%99 = add nsw i32 %98, 4
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %97, i64 %100
store i32 %96, i32* %101
br label %102
102: ; preds = %92
%103 = load i32, i32* %5
%104 = add nsw i32 %103, 1
store i32 %104, i32* %5
br label %89
105: ; preds = %89
ret void
}

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