#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 */
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  int member_0;
  int member_1;
  int member_2;
  int member_3;
  int member_4;
  int member_5;
  int member_6;
  int member_7;
};
typedef int /*<<< orphan*/ DES_key_schedule;
typedef TYPE_1__ DES_cblock;

/* Variables and functions */
scalar_t__ DES_set_key_checked(TYPE_1__ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ DES_set_odd_parity(TYPE_1__ *);
int decrypt_des(char *, char *, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                int /*<<< orphan*/ *, TYPE_1__ *, int);
int encrypt_des(TYPE_1__ *, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                int /*<<< orphan*/ *, char *, char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main() {
  DES_cblock cb1 = {0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE};
  DES_cblock cb2 = {0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE};
  DES_cblock cb3 = {0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE, 0xAE};
  DES_key_schedule ks1, ks2, ks3;
  DES_cblock cblock = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  char string[] = "I am a software developer, bbbxxxxxxxxxx, gjeogjeogjeojsb";
  int ret = -1;
  int stringLen = strlen(string) + 1;
  int cipherLen = stringLen * 2;
  printf("Plain Text : %s\n", string);
  char *cipher = (char *)malloc(cipherLen);
  char *text = (char *)malloc(stringLen);
  memset(cipher, 0, cipherLen);
  memset(text, 0, stringLen);
  DES_set_odd_parity(&cblock);
  if (DES_set_key_checked(&cb1, &ks1) || DES_set_key_checked(&cb2, &ks2) ||
      DES_set_key_checked(&cb3, &ks3)) {
    printf("Key error, exiting ....\n");
    return 1;
  }
  ret = encrypt_des(&cblock, &ks1, &ks2, &ks3, cipher, string, stringLen);
  if (ret < 0) {
    return ret;
  }
  ret = decrypt_des(cipher, text, &ks1, &ks2, &ks3, &cblock, cipherLen);
  if (ret < 0) {
    return ret;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe57(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe54(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe51(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe4e(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe2b(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe28(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe25(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe22(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xdff(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xdfc(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xdf9(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xdf6(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    -0x98(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
lea    -0xe0(%rbp),%rdi
lea    0xdd9(%rip),%rsi
mov    $0x3a,%edx
call   1070 <memcpy@plt>
movl   $0xffffffff,-0xe4(%rbp)
ff ff ff
lea    -0xe0(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
mov    -0xe8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xec(%rbp)
lea    -0xe0(%rbp),%rsi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xec(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0xf8(%rbp)
mov    -0xe8(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x100(%rbp)
mov    -0xf8(%rbp),%rdi
mov    -0xec(%rbp),%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    -0x100(%rbp),%rdi
mov    -0xe8(%rbp),%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    -0x98(%rbp),%rdi
call   10a0 <DES_set_odd_parity@plt>
lea    -0x28(%rbp),%rdi
lea    -0x6c(%rbp),%rsi
call   1090 <DES_set_key_checked@plt>
cmp    $0x0,%rax
jne    1331 <main+0x1a1>
lea    -0x48(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1090 <DES_set_key_checked@plt>
cmp    $0x0,%rax
jne    1331 <main+0x1a1>
lea    -0x68(%rbp),%rdi
lea    -0x74(%rbp),%rsi
call   1090 <DES_set_key_checked@plt>
cmp    $0x0,%rax
je     134b <main+0x1bb>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13f2 <main+0x262>
mov    -0xf8(%rbp),%r8
lea    -0xe0(%rbp),%r9
mov    -0xe8(%rbp),%eax
lea    -0x98(%rbp),%rdi
lea    -0x6c(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rcx
mov    %eax,(%rsp)
call   10b0 <encrypt_des@plt>
mov    %eax,-0xe4(%rbp)
cmpl   $0x0,-0xe4(%rbp)
jge    139b <main+0x20b>
mov    -0xe4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f2 <main+0x262>
mov    -0xf8(%rbp),%rdi
mov    -0x100(%rbp),%rsi
mov    -0xec(%rbp),%eax
lea    -0x6c(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    -0x74(%rbp),%r8
lea    -0x98(%rbp),%r9
mov    %eax,(%rsp)
call   1030 <decrypt_des@plt>
mov    %eax,-0xe4(%rbp)
cmpl   $0x0,-0xe4(%rbp)
jge    13eb <main+0x25b>
mov    -0xe4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f2 <main+0x262>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe0,%rsp
movups 0xe6a(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movups 0xe4b(%rip),%xmm1
movaps %xmm1,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm1,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm1,0x80(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movups 0xe59(%rip),%xmm0
movups %xmm0,0x6a(%rsp)
movaps 0xe43(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe27(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe0b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    (%rax,%rax,1),%r12d
add    $0x2,%r12d
mov    %eax,%ebp
add    $0x1,%ebp
lea    0xe1f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
xor    %esi,%esi
mov    %r12d,%edx
call   1070 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1070 <memset@plt>
lea    0x20(%rsp),%rdi
call   10a0 <DES_set_odd_parity@plt>
lea    0xc0(%rsp),%rdi
lea    0x1c(%rsp),%rsi
call   1090 <DES_set_key_checked@plt>
test   %rax,%rax
jne    12c2 <main+0x132>
lea    0xa0(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1090 <DES_set_key_checked@plt>
test   %rax,%rax
jne    12c2 <main+0x132>
lea    0x80(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1090 <DES_set_key_checked@plt>
test   %rax,%rax
je     12e3 <main+0x153>
lea    0xda2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,(%rsp)
lea    0x20(%rsp),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x40(%rsp),%r9
mov    %r14,%r8
call   10b0 <encrypt_des@plt>
test   %eax,%eax
js     12d3 <main+0x143>
mov    %r12d,(%rsp)
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0x20(%rsp),%r9
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <decrypt_des@plt>
mov    %eax,%ecx
sar    $0x1f,%eax
and    %ecx,%eax
jmp    12d3 <main+0x143>

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, i32, i32, i32, i32, i32, i32, i32 }
@__const.main.cb1 = %struct.TYPE_6__ { i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174 }
@__const.main.cb2 = %struct.TYPE_6__ { i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174 }
@__const.main.cb3 = %struct.TYPE_6__ { i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174 }
@__const.main.string = [58 x i8] c"I am a software developer, bbbxxxxxxxxxx, gjeogjeogjeojsb\00"
@.str = [17 x i8] c"Plain Text : %s\0A\00"
@.str.1 = [25 x i8] c"Key error, exiting ....\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.TYPE_6__
%3 = alloca %struct.TYPE_6__
%4 = alloca %struct.TYPE_6__
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.TYPE_6__
%9 = alloca [58 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
store i32 0, i32* %1
%15 = bitcast %struct.TYPE_6__* %2 to i8*
%16 = bitcast %struct.TYPE_6__* %3 to i8*
%17 = bitcast %struct.TYPE_6__* %4 to i8*
%18 = bitcast %struct.TYPE_6__* %8 to i8*
%19 = bitcast [58 x i8]* %9 to i8*
store i32 -1, i32* %10
%20 = getelementptr inbounds [58 x i8], [58 x i8]* %9, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = add nsw i32 %21, 1
store i32 %22, i32* %11
%23 = load i32, i32* %11
%24 = mul nsw i32 %23, 2
store i32 %24, i32* %12
%25 = getelementptr inbounds [58 x i8], [58 x i8]* %9, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* %12
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %13
%30 = load i32, i32* %11
%31 = call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to i8*
store i8* %32, i8** %14
%33 = load i8*, i8** %13
%34 = load i32, i32* %12
%35 = call i32 @memset(i8* %33, i32 0, i32 %34)
%36 = load i8*, i8** %14
%37 = load i32, i32* %11
%38 = call i32 @memset(i8* %36, i32 0, i32 %37)
%39 = call i32 @DES_set_odd_parity(%struct.TYPE_6__* %8)
%40 = call i64 @DES_set_key_checked(%struct.TYPE_6__* %2, i32* %5)
%41 = icmp ne i64 %40, 0
br i1 %41, label %48, label %42
42: ; preds = %0
%43 = call i64 @DES_set_key_checked(%struct.TYPE_6__* %3, i32* %6)
%44 = icmp ne i64 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = call i64 @DES_set_key_checked(%struct.TYPE_6__* %4, i32* %7)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45, %42, %0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %69
50: ; preds = %45
%51 = load i8*, i8** %13
%52 = getelementptr inbounds [58 x i8], [58 x i8]* %9, i64 0, i64 0
%53 = load i32, i32* %11
%54 = call i32 @encrypt_des(%struct.TYPE_6__* %8, i32* %5, i32* %6, i32* %7, i8* %51, i8* %52, i32 %53)
store i32 %54, i32* %10
%55 = load i32, i32* %10
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %50
%58 = load i32, i32* %10
store i32 %58, i32* %1
br label %69
59: ; preds = %50
%60 = load i8*, i8** %13
%61 = load i8*, i8** %14
%62 = load i32, i32* %12
%63 = call i32 @decrypt_des(i8* %60, i8* %61, i32* %5, i32* %6, i32* %7, %struct.TYPE_6__* %8, i32 %62)
store i32 %63, i32* %10
%64 = load i32, i32* %10
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %59
%67 = load i32, i32* %10
store i32 %67, i32* %1
br label %69
68: ; preds = %59
store i32 0, i32* %1
br label %69
69: ; preds = %68, %66, %57, %48
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32, i32, i32, i32, i32, i32, i32, i32 }
@__const.main.cb3 = %struct.TYPE_6__ { i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174, i32 174 }
@__const.main.string = [58 x i8] c"I am a software developer, bbbxxxxxxxxxx, gjeogjeogjeojsb\00"
@.str = [17 x i8] c"Plain Text : %s\0A\00"
@str = [24 x i8] c"Key error, exiting ....\00"
define i32 @main() {
%1 = alloca %struct.TYPE_6__
%2 = alloca %struct.TYPE_6__
%3 = alloca %struct.TYPE_6__
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.TYPE_6__
%8 = alloca [58 x i8]
%9 = bitcast %struct.TYPE_6__* %1 to i8*
%10 = bitcast %struct.TYPE_6__* %2 to i8*
%11 = bitcast %struct.TYPE_6__* %3 to i8*
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast %struct.TYPE_6__* %7 to i8*
%16 = getelementptr inbounds [58 x i8], [58 x i8]* %8, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = add nsw i32 %17, 1
%19 = shl nsw i32 %18, 1
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %16)
%21 = call i64 @malloc(i32 %19)
%22 = inttoptr i64 %21 to i8*
%23 = call i64 @malloc(i32 %18)
%24 = inttoptr i64 %23 to i8*
%25 = call i32 @memset(i8* %22, i32 0, i32 %19)
%26 = call i32 @memset(i8* %24, i32 0, i32 %18)
%27 = call i32 @DES_set_odd_parity(%struct.TYPE_6__* %7)
%28 = call i64 @DES_set_key_checked(%struct.TYPE_6__* %1, i32* %4)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %0
%31 = call i64 @DES_set_key_checked(%struct.TYPE_6__* %2, i32* %5)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = call i64 @DES_set_key_checked(%struct.TYPE_6__* %3, i32* %6)
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33, %30, %0
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %45
38: ; preds = %33
%39 = call i32 @encrypt_des(%struct.TYPE_6__* %7, i32* %4, i32* %5, i32* %6, i8* %22, i8* %16, i32 %18)
%40 = icmp slt i32 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %38
%42 = call i32 @decrypt_des(i8* %22, i8* %24, i32* %4, i32* %5, i32* %6, %struct.TYPE_6__* %7, i32 %19)
%43 = icmp slt i32 %42, 0
%44 = select i1 %43, i32 %42, i32 0
br label %45
45: ; preds = %41, %38, %36
%46 = phi i32 [ 1, %36 ], [ %39, %38 ], [ %44, %41 ]
ret i32 %46
}