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

/* Variables and functions */
int TwoFish__b(int, int);
u_int32_t _TwoFish_Fe32(u_int32_t *lsBox, u_int32_t x, u_int32_t R) {
  return lsBox[2 * TwoFish__b(x, R)] ^ lsBox[2 * TwoFish__b(x, R + 1) + 1] ^
         lsBox[0x200 + 2 * TwoFish__b(x, R + 2)] ^
         lsBox[0x200 + 2 * TwoFish__b(x, R + 3) + 1];
}


x86 assembly (clang, -O0):
<_TwoFish_Fe32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <TwoFish__b@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    $0x1,%esi
call   1030 <TwoFish__b@plt>
mov    -0x40(%rbp),%rcx
mov    %eax,%edx
mov    -0x34(%rbp),%eax
shl    $0x1,%edx
add    $0x1,%edx
movslq %edx,%rdx
xor    (%rcx,%rdx,4),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    $0x2,%esi
call   1030 <TwoFish__b@plt>
mov    -0x30(%rbp),%rcx
mov    %eax,%edx
mov    -0x24(%rbp),%eax
shl    $0x1,%edx
add    $0x200,%edx
movslq %edx,%rdx
xor    (%rcx,%rdx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    $0x3,%esi
call   1030 <TwoFish__b@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
shl    $0x1,%edx
add    $0x200,%edx
add    $0x1,%edx
movslq %edx,%rdx
xor    (%rcx,%rdx,4),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_TwoFish_Fe32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r14
mov    %esi,%edi
mov    %edx,%esi
call   1030 <TwoFish__b@plt>
add    %eax,%eax
cltq
mov    (%r14,%rax,4),%ebp
lea    0x1(%rbx),%esi
mov    %r15d,%edi
call   1030 <TwoFish__b@plt>
add    %eax,%eax
add    $0x1,%eax
cltq
xor    (%r14,%rax,4),%ebp
lea    0x2(%rbx),%esi
mov    %r15d,%edi
call   1030 <TwoFish__b@plt>
add    %eax,%eax
cltq
xor    0x800(%r14,%rax,4),%ebp
add    $0x3,%ebx
mov    %r15d,%edi
mov    %ebx,%esi
call   1030 <TwoFish__b@plt>
add    %eax,%eax
cltq
xor    0x804(%r14,%rax,4),%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_TwoFish_Fe32(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @TwoFish__b(i32 %8, i32 %9)
%11 = mul nsw i32 2, %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %7, i64 %12
%14 = load i32, i32* %13
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
%19 = call i32 @TwoFish__b(i32 %16, i32 %18)
%20 = mul nsw i32 2, %19
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %15, i64 %22
%24 = load i32, i32* %23
%25 = xor i32 %14, %24
%26 = load i32*, i32** %4
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 2
%30 = call i32 @TwoFish__b(i32 %27, i32 %29)
%31 = mul nsw i32 2, %30
%32 = add nsw i32 512, %31
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %26, i64 %33
%35 = load i32, i32* %34
%36 = xor i32 %25, %35
%37 = load i32*, i32** %4
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 3
%41 = call i32 @TwoFish__b(i32 %38, i32 %40)
%42 = mul nsw i32 2, %41
%43 = add nsw i32 512, %42
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %37, i64 %45
%47 = load i32, i32* %46
%48 = xor i32 %36, %47
ret i32 %48
}

LLVM IR (-O2):
define i32 @_TwoFish_Fe32(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @TwoFish__b(i32 %1, i32 %2)
%5 = shl nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = add nsw i32 %2, 1
%10 = tail call i32 @TwoFish__b(i32 %1, i32 %9)
%11 = shl nsw i32 %10, 1
%12 = or i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = xor i32 %15, %8
%17 = add nsw i32 %2, 2
%18 = tail call i32 @TwoFish__b(i32 %1, i32 %17)
%19 = shl nsw i32 %18, 1
%20 = add nsw i32 %19, 512
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %0, i64 %21
%23 = load i32, i32* %22
%24 = xor i32 %16, %23
%25 = add nsw i32 %2, 3
%26 = tail call i32 @TwoFish__b(i32 %1, i32 %25)
%27 = shl nsw i32 %26, 1
%28 = add nsw i32 %27, 513
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %0, i64 %29
%31 = load i32, i32* %30
%32 = xor i32 %24, %31
ret i32 %32
}