#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];
  int i;
  xor4(state, in, key);
  arx_fwd(state);
  xor4(state, state, key + 4);
  arx_fwd(state);
  xor4(state, state, key + 8);
  arx_fwd(state);
  xor4(state, state, key + 12);
  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>
lea    -0x1c(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0xc,%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   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %rdi,%r14
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <xor4@plt>
mov    %rbx,%rdi
call   1040 <arx_fwd@plt>
lea    0x4(%r15),%r12
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1030 <xor4@plt>
mov    %rbx,%rdi
call   1040 <arx_fwd@plt>
lea    0x8(%r15),%r13
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1030 <xor4@plt>
mov    %rbx,%rdi
call   1040 <arx_fwd@plt>
add    $0xc,%r15
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <xor4@plt>
mov    %rbx,%rdi
call   1040 <arx_fwd@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1030 <xor4@plt>
mov    %rbx,%rdi
call   1040 <arx_fwd@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1030 <xor4@plt>
mov    %rbx,%rdi
call   1040 <arx_fwd@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <xor4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
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]
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @xor4(i8* %9, i8* %10, i8* %11)
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%14 = call i32 @arx_fwd(i8* %13)
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i64 4
%19 = call i32 @xor4(i8* %15, i8* %16, i8* %18)
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%21 = call i32 @arx_fwd(i8* %20)
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i64 8
%26 = call i32 @xor4(i8* %22, i8* %23, i8* %25)
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%28 = call i32 @arx_fwd(i8* %27)
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i64 12
%33 = call i32 @xor4(i8* %29, i8* %30, i8* %32)
%34 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%35 = call i32 @arx_fwd(i8* %34)
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%38 = load i8*, i8** %6
%39 = getelementptr inbounds i8, i8* %38, i64 4
%40 = call i32 @xor4(i8* %36, i8* %37, i8* %39)
%41 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%42 = call i32 @arx_fwd(i8* %41)
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%45 = load i8*, i8** %6
%46 = getelementptr inbounds i8, i8* %45, i64 8
%47 = call i32 @xor4(i8* %43, i8* %44, i8* %46)
%48 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%49 = call i32 @arx_fwd(i8* %48)
%50 = load i8*, i8** %4
%51 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%52 = load i8*, i8** %6
%53 = getelementptr inbounds i8, i8* %52, i64 12
%54 = call i32 @xor4(i8* %50, i8* %51, i8* %53)
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* %5, i8* %5, i8* %14)
%16 = call i32 @arx_fwd(i8* %5)
%17 = call i32 @xor4(i8* %5, i8* %5, i8* %8)
%18 = call i32 @arx_fwd(i8* %5)
%19 = call i32 @xor4(i8* %5, i8* %5, i8* %11)
%20 = call i32 @arx_fwd(i8* %5)
%21 = call i32 @xor4(i8* %0, i8* %5, i8* %14)
ret i32 0
}