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

/* Variables and functions */
int /*<<< orphan*/ DES_ecb_encrypt(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ *, int);
int /*<<< orphan*/ DES_set_key_checked(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ MakeKey(unsigned char *, unsigned char *);
void DesEncrypt(unsigned char *clear, unsigned char *key,
                unsigned char *cipher) {
  DES_key_schedule ks;
  unsigned char des_key[8];
  MakeKey(key, des_key);
  DES_set_key_checked((DES_cblock *)des_key, &ks);
  DES_ecb_encrypt((const_DES_cblock *)clear, (DES_cblock *)cipher, &ks, 1);
}


x86 assembly (clang, -O0):
<DesEncrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1030 <MakeKey@plt>
lea    -0x24(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <DES_set_key_checked@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <DES_ecb_encrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DesEncrypt>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%r15
mov    %rsi,%rdi
mov    %r15,%rsi
call   1030 <MakeKey@plt>
lea    0xc(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <DES_set_key_checked@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    $0x1,%ecx
call   1040 <DES_ecb_encrypt@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @DesEncrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [8 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%11 = call i32 @MakeKey(i8* %9, i8* %10)
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%13 = bitcast i8* %12 to i32*
%14 = call i32 @DES_set_key_checked(i32* %13, i32* %7)
%15 = load i8*, i8** %4
%16 = bitcast i8* %15 to i32*
%17 = load i8*, i8** %6
%18 = bitcast i8* %17 to i32*
%19 = call i32 @DES_ecb_encrypt(i32* %16, i32* %18, i32* %7, i32 1)
ret void
}

LLVM IR (-O2):
define void @DesEncrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca [8 x i8]
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%8 = call i32 @MakeKey(i8* %1, i8* %7)
%9 = bitcast [8 x i8]* %5 to i32*
%10 = call i32 @DES_set_key_checked(i32* %9, i32* %4)
%11 = bitcast i8* %0 to i32*
%12 = bitcast i8* %2 to i32*
%13 = call i32 @DES_ecb_encrypt(i32* %11, i32* %12, i32* %4, i32 1)
ret void
}