#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 */

/* Variables and functions */
int /*<<< orphan*/ SDes(int, unsigned char *, unsigned char *, unsigned char *);
void TDes(unsigned char orientation, unsigned char *PlainText,
          unsigned char *key, unsigned char *ucEncipher) {
  unsigned char En[8];
  if (orientation == 0) {
    SDes(0, PlainText, key, En);
    SDes(1, En, &key[8], En);
    SDes(0, En, &key[0], ucEncipher);
  } else {
    SDes(1, PlainText, key, En);
    SDes(0, En, &key[8], En);
    SDes(1, En, &key[0], ucEncipher);
  }
  return;
}


x86 assembly (clang, -O0):
<TDes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    117c <TDes+0x6c>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x28(%rbp),%rcx
xor    %edi,%edi
call   1030 <SDes@plt>
lea    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
lea    -0x28(%rbp),%rcx
mov    $0x1,%edi
call   1030 <SDes@plt>
lea    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %edi,%edi
call   1030 <SDes@plt>
jmp    11bf <TDes+0xaf>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x28(%rbp),%rcx
mov    $0x1,%edi
call   1030 <SDes@plt>
lea    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
lea    -0x28(%rbp),%rcx
xor    %edi,%edi
call   1030 <SDes@plt>
lea    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%edi
call   1030 <SDes@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TDes>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
test   %edi,%edi
sete   %bpl
setne  %bl
lea    0x8(%rsp),%r12
mov    %ebx,%edi
mov    %r12,%rcx
call   1030 <SDes@plt>
lea    0x8(%r15),%rdx
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r12,%rcx
call   1030 <SDes@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <SDes@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @TDes(i8 zeroext %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [8 x i8]
store i8 %0, i8* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %4
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%17 = call i32 @SDes(i32 0, i8* %14, i8* %15, i8* %16)
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%19 = load i8*, i8** %7
%20 = getelementptr inbounds i8, i8* %19, i64 8
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%22 = call i32 @SDes(i32 1, i8* %18, i8* %20, i8* %21)
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8*, i8** %8
%27 = call i32 @SDes(i32 0, i8* %23, i8* %25, i8* %26)
br label %43
28: ; preds = %4
%29 = load i8*, i8** %6
%30 = load i8*, i8** %7
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%32 = call i32 @SDes(i32 1, i8* %29, i8* %30, i8* %31)
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %34, i64 8
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%37 = call i32 @SDes(i32 0, i8* %33, i8* %35, i8* %36)
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%39 = load i8*, i8** %7
%40 = getelementptr inbounds i8, i8* %39, i64 0
%41 = load i8*, i8** %8
%42 = call i32 @SDes(i32 1, i8* %38, i8* %40, i8* %41)
br label %43
43: ; preds = %28, %13
ret void
}

LLVM IR (-O2):
define void @TDes(i8 zeroext %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [8 x i8]
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%7 = icmp eq i8 %0, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
%10 = zext i1 %7 to i32
%11 = call i32 @SDes(i32 %9, i8* %1, i8* %2, i8* %6)
%12 = getelementptr inbounds i8, i8* %2, i64 8
%13 = call i32 @SDes(i32 %10, i8* %6, i8* %12, i8* %6)
%14 = call i32 @SDes(i32 %9, i8* %6, i8* %2, i8* %3)
ret void
}