#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 char *DES_cblock;

/* Variables and functions */
int /*<<< orphan*/ DES_DECRYPT;
int /*<<< orphan*/ DES_cfb64_encrypt(unsigned char *, unsigned char *, int,
                                     int /*<<< orphan*/ *, char **, int *,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ DES_set_key_checked(char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ DES_set_odd_parity(char **);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
void decrypt(char *key, char *msg, int size) {
  static char *result;
  int n = 0;
  DES_cblock key2;
  DES_key_schedule schedule;
  result = (char *)malloc(size);
  memcpy(key2, key, 8);
  DES_set_odd_parity(&key2);
  DES_set_key_checked(&key2, &schedule);
  DES_cfb64_encrypt((unsigned char *)msg, (unsigned char *)result, size,
                    &schedule, &key2, &n, DES_DECRYPT);
  memcpy(msg, result, size);
  free(result);
}


x86 assembly (clang, -O0):
<decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <malloc@plt>
mov    %rax,0x2ecf(%rip)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
lea    -0x20(%rbp),%rdi
call   1080 <DES_set_odd_parity@plt>
lea    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1070 <DES_set_key_checked@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e9c(%rip),%rsi
mov    -0x14(%rbp),%edx
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
lea    -0x24(%rbp),%rcx
lea    -0x20(%rbp),%r8
lea    -0x18(%rbp),%r9
mov    %eax,(%rsp)
call   1040 <DES_cfb64_encrypt@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e71(%rip),%rsi
mov    -0x14(%rbp),%edx
call   1050 <memcpy@plt>
mov    0x2e62(%rip),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x0,0x8(%rsp)
mov    %edx,%edi
call   1060 <malloc@plt>
mov    %rax,0x2ed0(%rip)
mov    %rbx,%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <DES_set_odd_parity@plt>
lea    0xc(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <DES_set_key_checked@plt>
mov    0x2e9f(%rip),%rsi
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
lea    0x8(%rsp),%r9
mov    %r14,%rdi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %rbx,%r8
call   1040 <DES_cfb64_encrypt@plt>
mov    0x2e77(%rip),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
call   1050 <memcpy@plt>
mov    0x2e66(%rip),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@decrypt.result = internal global i8* null
@DES_DECRYPT = global i32 0
define void @decrypt(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%10 = load i32, i32* %6
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** @decrypt.result
%13 = load i8*, i8** %8
%14 = load i8*, i8** %4
%15 = call i32 @memcpy(i8* %13, i8* %14, i32 8)
%16 = call i32 @DES_set_odd_parity(i8** %8)
%17 = call i32 @DES_set_key_checked(i8** %8, i32* %9)
%18 = load i8*, i8** %5
%19 = load i8*, i8** @decrypt.result
%20 = load i32, i32* %6
%21 = load i32, i32* @DES_DECRYPT
%22 = call i32 @DES_cfb64_encrypt(i8* %18, i8* %19, i32 %20, i32* %9, i8** %8, i32* %7, i32 %21)
%23 = load i8*, i8** %5
%24 = load i8*, i8** @decrypt.result
%25 = load i32, i32* %6
%26 = call i32 @memcpy(i8* %23, i8* %24, i32 %25)
%27 = load i8*, i8** @decrypt.result
%28 = call i32 @free(i8* %27)
ret void
}

LLVM IR (-O2):
@decrypt.result = internal unnamed_addr global i8* null
@DES_DECRYPT = global i32 0
define void @decrypt(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = bitcast i8** %5 to i8*
%9 = bitcast i32* %6 to i8*
%10 = tail call i64 @malloc(i32 %2)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** @decrypt.result
%12 = tail call i32 @memcpy(i8* undef, i8* %0, i32 8)
%13 = call i32 @DES_set_odd_parity(i8** %5)
%14 = call i32 @DES_set_key_checked(i8** %5, i32* %6)
%15 = load i8*, i8** @decrypt.result
%16 = load i32, i32* @DES_DECRYPT
%17 = call i32 @DES_cfb64_encrypt(i8* %1, i8* %15, i32 %2, i32* %6, i8** %5, i32* %4, i32 %16)
%18 = load i8*, i8** @decrypt.result
%19 = call i32 @memcpy(i8* %1, i8* %18, i32 %2)
%20 = load i8*, i8** @decrypt.result
%21 = call i32 @free(i8* %20)
ret void
}