#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 /*<<< orphan*/ DES_key_schedule;
typedef int /*<<< orphan*/ DES_cblock;

/* Variables and functions */
int /*<<< orphan*/ DES_ENCRYPT;
int /*<<< orphan*/ DES_ede3_cbc_encrypt(unsigned char const *, unsigned char *,
                                        int, int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *,
                                        int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int encrypt_des(DES_cblock *cblock, DES_key_schedule *ks1,
                DES_key_schedule *ks2, DES_key_schedule *ks3, char *cipher,
                char *string, int stringLen) {
  DES_ede3_cbc_encrypt((const unsigned char *)string, (unsigned char *)cipher,
                       stringLen, ks1, ks2, ks3, cblock, DES_ENCRYPT);
  printf("Encrypted : %32.32s\n", cipher);
  return 0;
}


x86 assembly (clang, -O0):
<encrypt_des>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x10(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x8(%rbp),%r10
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <DES_ede3_cbc_encrypt@plt>
mov    -0x28(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encrypt_des>:
push   %rbx
mov    %r8,%rbx
mov    %rcx,%r11
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%r10
mov    0x10(%rsp),%edx
mov    0x2ea5(%rip),%rsi
mov    (%rsi),%eax
mov    %r9,%rdi
mov    %rbx,%rsi
mov    %r11,%r9
push   %rax
push   %r10
call   1030 <DES_ede3_cbc_encrypt@plt>
add    $0x10,%rsp
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@DES_ENCRYPT = global i32 0
@.str = [21 x i8] c"Encrypted : %32.32s\0A\00"
define i32 @encrypt_des(i32* %0, i32* %1, i32* %2, i32* %3, i8* %4, i8* %5, i32 %6) {
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
store i32* %0, i32** %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i32* %3, i32** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i32 %6, i32* %14
%15 = load i8*, i8** %13
%16 = load i8*, i8** %12
%17 = load i32, i32* %14
%18 = load i32*, i32** %9
%19 = load i32*, i32** %10
%20 = load i32*, i32** %11
%21 = load i32*, i32** %8
%22 = load i32, i32* @DES_ENCRYPT
%23 = call i32 @DES_ede3_cbc_encrypt(i8* %15, i8* %16, i32 %17, i32* %18, i32* %19, i32* %20, i32* %21, i32 %22)
%24 = load i8*, i8** %12
%25 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@DES_ENCRYPT = global i32 0
@.str = [21 x i8] c"Encrypted : %32.32s\0A\00"
define i32 @encrypt_des(i32* %0, i32* %1, i32* %2, i32* %3, i8* %4, i8* %5, i32 %6) {
%8 = load i32, i32* @DES_ENCRYPT
%9 = tail call i32 @DES_ede3_cbc_encrypt(i8* %5, i8* %4, i32 %6, i32* %1, i32* %2, i32* %3, i32* %0, i32 %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}