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

/* Variables and functions */
int READ_ROUND_KEY_DOUBLE_WORD(int);
int rot32l8(int);
int rot32r8(int);
int /*<<< orphan*/ speckey_inverse(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void round_f_inverse(uint32_t *left, uint32_t *right, uint32_t *roundKeys) {
  uint32_t temp;
  int8_t i;
  uint16_t *b0_l = (uint16_t *)left;
  uint16_t *b0_r = (uint16_t *)left + 1;
  uint16_t *b1_l = (uint16_t *)right;
  uint16_t *b1_r = (uint16_t *)right + 1;
  temp = *right;
  *left ^= *right ^ rot32l8(*right) ^ rot32r8(*right);
  *right = *left;
  *left = temp;
  for (i = 2; i >= 0; i--) {
    speckey_inverse(b1_l, b1_r);
    *right ^= READ_ROUND_KEY_DOUBLE_WORD(roundKeys[i + 3]);
  }
  for (i = 2; i >= 0; i--) {
    speckey_inverse(b0_l, b0_r);
    *left ^= READ_ROUND_KEY_DOUBLE_WORD(roundKeys[i]);
  }
}


x86 assembly (clang, -O0):
<round_f_inverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1050 <rot32l8@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <rot32r8@plt>
mov    -0x44(%rbp),%ecx
xor    %eax,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x2,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     121b <round_f_inverse+0xdb>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1040 <speckey_inverse@plt>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11d7 <round_f_inverse+0x97>
movl   $0x2,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1261 <round_f_inverse+0x121>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <speckey_inverse@plt>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1222 <round_f_inverse+0xe2>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_f_inverse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0x4(%rsi),%r12
mov    (%rsi),%r13d
mov    %r13d,%edi
call   1050 <rot32l8@plt>
mov    %eax,%ebp
xor    %r13d,%ebp
mov    (%rbx),%edi
call   1030 <rot32r8@plt>
xor    %ebp,%eax
xor    (%r15),%eax
mov    %eax,(%rbx)
mov    %r13d,(%r15)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <speckey_inverse@plt>
mov    0x14(%r14),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%rbx)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <speckey_inverse@plt>
mov    0x10(%r14),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%rbx)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <speckey_inverse@plt>
mov    0xc(%r14),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%rbx)
lea    0x4(%r15),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <speckey_inverse@plt>
mov    0x8(%r14),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%r15)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <speckey_inverse@plt>
mov    0x4(%r14),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%r15)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <speckey_inverse@plt>
mov    (%r14),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @round_f_inverse(i32* %0, i32* %1, i32* nocapture %2) {
%4 = getelementptr inbounds i32, i32* %1, i64 1
%5 = load i32, i32* %1
%6 = tail call i32 @rot32l8(i32 %5)
%7 = xor i32 %6, %5
%8 = load i32, i32* %1
%9 = tail call i32 @rot32r8(i32 %8)
%10 = xor i32 %7, %9
%11 = load i32, i32* %0
%12 = xor i32 %10, %11
store i32 %12, i32* %1
store i32 %5, i32* %0
%13 = tail call i32 @speckey_inverse(i32* %1, i32* %4)
%14 = getelementptr inbounds i32, i32* %2, i64 5
%15 = load i32, i32* %14
%16 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %15)
%17 = load i32, i32* %1
%18 = xor i32 %17, %16
store i32 %18, i32* %1
%19 = tail call i32 @speckey_inverse(i32* %1, i32* %4)
%20 = getelementptr inbounds i32, i32* %2, i64 4
%21 = load i32, i32* %20
%22 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %21)
%23 = load i32, i32* %1
%24 = xor i32 %23, %22
store i32 %24, i32* %1
%25 = tail call i32 @speckey_inverse(i32* %1, i32* %4)
%26 = getelementptr inbounds i32, i32* %2, i64 3
%27 = load i32, i32* %26
%28 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %27)
%29 = load i32, i32* %1
%30 = xor i32 %29, %28
store i32 %30, i32* %1
%31 = getelementptr inbounds i32, i32* %0, i64 1
%32 = tail call i32 @speckey_inverse(i32* %0, i32* %31)
%33 = getelementptr inbounds i32, i32* %2, i64 2
%34 = load i32, i32* %33
%35 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %34)
%36 = load i32, i32* %0
%37 = xor i32 %36, %35
store i32 %37, i32* %0
%38 = tail call i32 @speckey_inverse(i32* %0, i32* %31)
%39 = getelementptr inbounds i32, i32* %2, i64 1
%40 = load i32, i32* %39
%41 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %40)
%42 = load i32, i32* %0
%43 = xor i32 %42, %41
store i32 %43, i32* %0
%44 = tail call i32 @speckey_inverse(i32* %0, i32* %31)
%45 = load i32, i32* %2
%46 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %45)
%47 = load i32, i32* %0
%48 = xor i32 %47, %46
store i32 %48, i32* %0
ret void
}