#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*/ ipcrypt_encrypt(unsigned char *, unsigned char const *,
                                   char const *);
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char, unsigned char,
                          unsigned char);
int main(void) {
  unsigned char out[4];
  const unsigned char in[4] = {1, 2, 3, 4};
  const char *key = "some 16-byte key";
  const char *key2 = "some 16-byte kex";
  ipcrypt_encrypt(out, in, key);
  printf("%d %d %d %d\n", out[0], out[1], out[2], out[3]);
  ipcrypt_encrypt(out, in, key2);
  printf("%d %d %d %d\n", out[0], out[1], out[2], out[3]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    0xec5(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <ipcrypt_encrypt@plt>
mov    -0x8(%rbp),%dl
mov    -0x7(%rbp),%cl
mov    -0x6(%rbp),%al
lea    0xeb7(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x5(%rbp),%r8d
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <ipcrypt_encrypt@plt>
mov    -0x8(%rbp),%dl
mov    -0x7(%rbp),%cl
mov    -0x6(%rbp),%al
lea    0xe83(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x5(%rbp),%r8d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x4030201,0xc(%rsp)
04
lea    0xec8(%rip),%rdx
lea    0x8(%rsp),%r15
lea    0xc(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <ipcrypt_encrypt@plt>
movzbl 0x8(%rsp),%esi
movzbl 0x9(%rsp),%edx
movzbl 0xa(%rsp),%ecx
movzbl 0xb(%rsp),%r8d
lea    0xeb9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xe99(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <ipcrypt_encrypt@plt>
movzbl 0x8(%rsp),%esi
movzbl 0x9(%rsp),%edx
movzbl 0xa(%rsp),%ecx
movzbl 0xb(%rsp),%r8d
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.in = [4 x i8] c"\01\02\03\04"
@.str = [17 x i8] c"some 16-byte key\00"
@.str.1 = [17 x i8] c"some 16-byte kex\00"
@.str.2 = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca [4 x i8]
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
%6 = bitcast [4 x i8]* %3 to i8*
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %5
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = call i32 @ipcrypt_encrypt(i8* %7, i8* %8, i8* %9)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%12 = load i8, i8* %11
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%14 = load i8, i8* %13
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%16 = load i8, i8* %15
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%18 = load i8, i8* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %12, i8 zeroext %14, i8 zeroext %16, i8 zeroext %18)
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%22 = load i8*, i8** %5
%23 = call i32 @ipcrypt_encrypt(i8* %20, i8* %21, i8* %22)
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%25 = load i8, i8* %24
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%27 = load i8, i8* %26
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%29 = load i8, i8* %28
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%31 = load i8, i8* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %25, i8 zeroext %27, i8 zeroext %29, i8 zeroext %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"some 16-byte key\00"
@.str.1 = [17 x i8] c"some 16-byte kex\00"
@.str.2 = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca [4 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 67305985, i32* %2
%5 = call i32 @ipcrypt_encrypt(i8* %3, i8* %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = load i8, i8* %3
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 1
%8 = load i8, i8* %7
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 2
%10 = load i8, i8* %9
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 3
%12 = load i8, i8* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %6, i8 zeroext %8, i8 zeroext %10, i8 zeroext %12)
%14 = call i32 @ipcrypt_encrypt(i8* %3, i8* %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8, i8* %3
%16 = load i8, i8* %7
%17 = load i8, i8* %9
%18 = load i8, i8* %11
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %15, i8 zeroext %16, i8 zeroext %17, i8 zeroext %18)
ret i32 0
}