#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_Fe320(u_int32_t *lsBox, u_int32_t x) {
  return lsBox[TwoFish__b(x, 0) << 1] ^ lsBox[((TwoFish__b(x, 1) << 1) | 1)] ^
         lsBox[0x200 + (TwoFish__b(x, 2) << 1)] ^
         lsBox[0x200 + ((TwoFish__b(x, 3) << 1) | 1)];
}


x86 assembly (clang, -O0):
<_TwoFish_Fe320>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1030 <TwoFish__b@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1030 <TwoFish__b@plt>
mov    -0x38(%rbp),%rcx
mov    %eax,%edx
mov    -0x2c(%rbp),%eax
shl    $0x1,%edx
or     $0x1,%edx
movslq %edx,%rdx
xor    (%rcx,%rdx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1030 <TwoFish__b@plt>
mov    -0x28(%rbp),%rcx
mov    %eax,%edx
mov    -0x1c(%rbp),%eax
shl    $0x1,%edx
add    $0x200,%edx
movslq %edx,%rdx
xor    (%rcx,%rdx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x3,%esi
call   1030 <TwoFish__b@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,%edx
mov    -0x10(%rbp),%eax
shl    $0x1,%edx
or     $0x1,%edx
add    $0x200,%edx
movslq %edx,%rdx
xor    (%rcx,%rdx,4),%eax
add    $0x40,%rsp
pop    %rbp
ret

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

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

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