#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*/ uint32_t;
typedef int int8_t;

/* Variables and functions */
int /*<<< orphan*/ READ_ROUND_KEY_DOUBLE_WORD(int /*<<< orphan*/);
int /*<<< orphan*/ doubleRound(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                               int /*<<< orphan*/, int /*<<< orphan*/);
void Decrypt(uint8_t *block, uint8_t *roundKeys) {
  int8_t i;
  uint32_t *rk = (uint32_t *)roundKeys;
  uint32_t *rightPtr = (uint32_t *)block;
  uint32_t *leftPtr = rightPtr + 1;
  uint32_t rk2ip1;
  uint32_t rk2i;
  for (i = 42 / 2 - 1; i >= 0; --i) {
    rk2ip1 = READ_ROUND_KEY_DOUBLE_WORD(rk[2 * i + 1]);
    rk2i = READ_ROUND_KEY_DOUBLE_WORD(rk[2 * i]);
    doubleRound(rightPtr, leftPtr, rk2ip1, rk2i);
  }
}


x86 assembly (clang, -O0):
<Decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x30(%rbp)
movl   $0x14,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11b1 <Decrypt+0x91>
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
call   1030 <doubleRound@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <Decrypt+0x33>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Decrypt>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
lea    0x4(%rdi),%r15
mov    $0x14,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x4(%r12,%rbx,8),%edi
call   1040 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ebp
mov    (%r12,%rbx,8),%edi
call   1040 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <doubleRound@plt>
add    $0xffffffffffffffff,%rbx
jb     1140 <Decrypt+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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 i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%11 = load i32*, i32** %4
store i32* %11, i32** %6
%12 = load i32*, i32** %3
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32* %14, i32** %8
store i32 20, i32* %5
br label %15
15: ; preds = %39, %2
%16 = load i32, i32* %5
%17 = icmp sge i32 %16, 0
br i1 %17, label %18, label %42
18: ; preds = %15
%19 = load i32*, i32** %6
%20 = load i32, i32* %5
%21 = mul nsw i32 2, %20
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %19, i64 %23
%25 = load i32, i32* %24
%26 = call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %25)
store i32 %26, i32* %9
%27 = load i32*, i32** %6
%28 = load i32, i32* %5
%29 = mul nsw i32 2, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %27, i64 %30
%32 = load i32, i32* %31
%33 = call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %32)
store i32 %33, i32* %10
%34 = load i32*, i32** %7
%35 = load i32*, i32** %8
%36 = load i32, i32* %9
%37 = load i32, i32* %10
%38 = call i32 @doubleRound(i32* %34, i32* %35, i32 %36, i32 %37)
br label %39
39: ; preds = %18
%40 = load i32, i32* %5
%41 = add nsw i32 %40, -1
store i32 %41, i32* %5
br label %15
42: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @Decrypt(i32* %0, i32* nocapture %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
br label %4
4: ; preds = %2, %4
%5 = phi i64 [ 20, %2 ], [ %15, %4 ]
%6 = shl nuw nsw i64 %5, 1
%7 = or i64 %6, 1
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %9)
%11 = getelementptr inbounds i32, i32* %1, i64 %6
%12 = load i32, i32* %11
%13 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %12)
%14 = tail call i32 @doubleRound(i32* %0, i32* %3, i32 %10, i32 %13)
%15 = add nsw i64 %5, -1
%16 = icmp eq i64 %5, 0
br i1 %16, label %17, label %4
17: ; preds = %4
ret void
}