#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 */

/* Variables and functions */
int /*<<< orphan*/ arx_fwd(unsigned char *);
int /*<<< orphan*/ xor4(unsigned char *, unsigned char const *,
                        unsigned char const *);
int ipcrypt_encrypt(unsigned char out[4], const unsigned char in[4],
                    const unsigned char key[16]) {
  unsigned char state[4];
  xor4(state, in, key);
  arx_fwd(state);
  xor4(state, state, key + 4);
  arx_fwd(state);
  xor4(state, state, key + 8);
  arx_fwd(state);
  xor4(out, state, key + 12);
  return 0;
}


x86 assembly (clang, -O0):
<ipcrypt_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <xor4@plt>
lea    -0x1c(%rbp),%rdi
call   1040 <arx_fwd@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x4,%rdx
call   1030 <xor4@plt>
lea    -0x1c(%rbp),%rdi
call   1040 <arx_fwd@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
call   1030 <xor4@plt>
lea    -0x1c(%rbp),%rdi
call   1040 <arx_fwd@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0xc,%rdx
call   1030 <xor4@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipcrypt_encrypt>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1030 <xor4@plt>
mov    %r15,%rdi
call   1040 <arx_fwd@plt>
lea    0x4(%rbx),%rdx
mov    %r15,%rdi
mov    %r15,%rsi
call   1030 <xor4@plt>
mov    %r15,%rdi
call   1040 <arx_fwd@plt>
lea    0x8(%rbx),%rdx
mov    %r15,%rdi
mov    %r15,%rsi
call   1030 <xor4@plt>
mov    %r15,%rdi
call   1040 <arx_fwd@plt>
add    $0xc,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <xor4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @ipcrypt_encrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [4 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @xor4(i8* %8, i8* %9, i8* %10)
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%13 = call i32 @arx_fwd(i8* %12)
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%16 = load i8*, i8** %6
%17 = getelementptr inbounds i8, i8* %16, i64 4
%18 = call i32 @xor4(i8* %14, i8* %15, i8* %17)
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%20 = call i32 @arx_fwd(i8* %19)
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%23 = load i8*, i8** %6
%24 = getelementptr inbounds i8, i8* %23, i64 8
%25 = call i32 @xor4(i8* %21, i8* %22, i8* %24)
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%27 = call i32 @arx_fwd(i8* %26)
%28 = load i8*, i8** %4
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i64 12
%32 = call i32 @xor4(i8* %28, i8* %29, i8* %31)
ret i32 0
}

LLVM IR (-O2):
define i32 @ipcrypt_encrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%6 = call i32 @xor4(i8* %5, i8* %1, i8* %2)
%7 = call i32 @arx_fwd(i8* %5)
%8 = getelementptr inbounds i8, i8* %2, i64 4
%9 = call i32 @xor4(i8* %5, i8* %5, i8* %8)
%10 = call i32 @arx_fwd(i8* %5)
%11 = getelementptr inbounds i8, i8* %2, i64 8
%12 = call i32 @xor4(i8* %5, i8* %5, i8* %11)
%13 = call i32 @arx_fwd(i8* %5)
%14 = getelementptr inbounds i8, i8* %2, i64 12
%15 = call i32 @xor4(i8* %0, i8* %5, i8* %14)
ret i32 0
}