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

/* Variables and functions */
int /*<<< orphan*/ DES_ENCRYPT;
int /*<<< orphan*/ DES_ecb_encrypt(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DES_set_key_unchecked(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ DES_set_odd_parity(int /*<<< orphan*/ *);
int /*<<< orphan*/ password_to_key(int /*<<< orphan*/ const *,
                                   int /*<<< orphan*/);
void des(const uint8_t password[7], const uint8_t data[8], uint8_t result[]) {
  DES_cblock key;
  DES_key_schedule schedule;
  password_to_key(password, key);
  DES_set_odd_parity(&key);
  DES_set_key_unchecked(&key, &schedule);
  DES_ecb_encrypt((DES_cblock *)data, (DES_cblock *)result, &schedule,
                  DES_ENCRYPT);
}


x86 assembly (clang, -O0):
<des>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <password_to_key@plt>
lea    -0x1c(%rbp),%rdi
call   1050 <DES_set_odd_parity@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <DES_set_key_unchecked@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2e5b(%rip),%rax
mov    (%rax),%ecx
lea    -0x20(%rbp),%rdx
call   1030 <DES_ecb_encrypt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<des>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
call   1040 <password_to_key@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <DES_set_odd_parity@plt>
mov    %rsp,%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <DES_set_key_unchecked@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <DES_ecb_encrypt@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@DES_ENCRYPT = global i32 0
define void @des(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %4
%10 = load i32, i32* %7
%11 = call i32 @password_to_key(i32* %9, i32 %10)
%12 = call i32 @DES_set_odd_parity(i32* %7)
%13 = call i32 @DES_set_key_unchecked(i32* %7, i32* %8)
%14 = load i32*, i32** %5
%15 = load i32*, i32** %6
%16 = load i32, i32* @DES_ENCRYPT
%17 = call i32 @DES_ecb_encrypt(i32* %14, i32* %15, i32* %8, i32 %16)
ret void
}

LLVM IR (-O2):
@DES_ENCRYPT = global i32 0
define void @des(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = tail call i32 @password_to_key(i32* %0, i32 undef)
%9 = call i32 @DES_set_odd_parity(i32* %4)
%10 = call i32 @DES_set_key_unchecked(i32* %4, i32* %5)
%11 = load i32, i32* @DES_ENCRYPT
%12 = call i32 @DES_ecb_encrypt(i32* %1, i32* %2, i32* %5, i32 %11)
ret void
}