#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_bwd(unsigned char *);
int /*<<< orphan*/ xor4(unsigned char *, unsigned char const *,
                        unsigned char const *);
int ipcrypt_decrypt(unsigned char out[4], const unsigned char in[4],
                    const unsigned char key[16]) {
  unsigned char state[4];
  xor4(state, in, key + 12);
  arx_bwd(state);
  xor4(state, state, key + 8);
  arx_bwd(state);
  xor4(state, state, key + 4);
  arx_bwd(state);
  xor4(out, state, key);
  return 0;
}


x86 assembly (clang, -O0):
<ipcrypt_decrypt>:
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
add    $0xc,%rdx
call   1040 <xor4@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <arx_bwd@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
call   1040 <xor4@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <arx_bwd@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x4,%rdx
call   1040 <xor4@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <arx_bwd@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <xor4@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ipcrypt_decrypt(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 = getelementptr inbounds i8, i8* %10, i64 12
%12 = call i32 @xor4(i8* %8, i8* %9, i8* %11)
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%14 = call i32 @arx_bwd(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 8
%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_bwd(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 4
%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_bwd(i8* %27)
%29 = load i8*, i8** %4
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%31 = load i8*, i8** %6
%32 = call i32 @xor4(i8* %29, i8* %30, i8* %31)
ret i32 0
}

LLVM IR (-O2):
define i32 @ipcrypt_decrypt(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 = getelementptr inbounds i8, i8* %2, i64 12
%7 = call i32 @xor4(i8* %5, i8* %1, i8* %6)
%8 = call i32 @arx_bwd(i8* %5)
%9 = getelementptr inbounds i8, i8* %2, i64 8
%10 = call i32 @xor4(i8* %5, i8* %5, i8* %9)
%11 = call i32 @arx_bwd(i8* %5)
%12 = getelementptr inbounds i8, i8* %2, i64 4
%13 = call i32 @xor4(i8* %5, i8* %5, i8* %12)
%14 = call i32 @arx_bwd(i8* %5)
%15 = call i32 @xor4(i8* %0, i8* %5, i8* %2)
ret i32 0
}