#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*/ szflag;
typedef int /*<<< orphan*/ szSource_file;
typedef int /*<<< orphan*/ szObject_file;

/* Variables and functions */
int /*<<< orphan*/ RSA_Decrypt(char *, char *);
int /*<<< orphan*/ RSA_Encrypt(char *, char *);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char szflag[5];
  char szSource_file[32];
  char szObject_file[32];
  if (argc != 4) {
    printf("\nUsage: makeDES <flag> <Source file> <Object file> <key>\n");
    printf("flag        -- 标识，为1时进行加密操作，为2时进行解密操作\n");
    printf("Source file -- 源文件\n");
    printf("Object file -- 目标文件\n");
    return 1;
  }
  bzero(szflag, sizeof(szflag));
  bzero(szSource_file, sizeof(szSource_file));
  bzero(szObject_file, sizeof(szObject_file));
  strcpy(szflag, argv[1]);
  strcpy(szSource_file, argv[2]);
  strcpy(szObject_file, argv[3]);
  if (strcmp(szflag, "1") == 0) {
    printf("\n您选择的方式是[flag=%s],加密操作\n", szflag);
  } else {
    printf("\n您选择的方式是[flag=%s],解密操作\n", szflag);
  }
  printf("Source file: %s\n", szSource_file);
  printf("Object file: %s\n", szObject_file);
  if (strcmp(szflag, "1") == 0) {
    RSA_Encrypt(szSource_file, szObject_file);
  } else {
    RSA_Decrypt(szSource_file, szObject_file);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11c4 <main+0x64>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12c8 <main+0x168>
lea    -0x15(%rbp),%rdi
mov    $0x5,%esi
call   1070 <bzero@plt>
lea    -0x40(%rbp),%rdi
mov    $0x20,%esi
call   1070 <bzero@plt>
lea    -0x60(%rbp),%rdi
mov    $0x20,%esi
call   1070 <bzero@plt>
lea    -0x15(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x15(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1252 <main+0xf2>
lea    -0x15(%rbp),%rsi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1264 <main+0x104>
lea    -0x15(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x15(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12b4 <main+0x154>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <RSA_Encrypt@plt>
jmp    12c1 <main+0x161>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1080 <RSA_Decrypt@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
cmp    $0x4,%edi
jne    1258 <main+0xe8>
mov    %rsi,%rbp
lea    0xb(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1080 <bzero@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1080 <bzero@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x20,%esi
call   1080 <bzero@plt>
mov    0x8(%rbp),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    0x10(%rbp),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    0x18(%rbp),%rsi
mov    %r15,%rdi
call   1040 <strcpy@plt>
lea    0xe17(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
lea    0xe04(%rip),%rax
lea    0xe2b(%rip),%rdi
cmove  %rax,%rdi
xor    %ebp,%ebp
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe42(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe42(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
test   %rax,%rax
je     128f <main+0x11f>
call   1090 <RSA_Decrypt@plt>
jmp    1294 <main+0x124>
lea    0xe21(%rip),%rdi
call   1050 <puts@plt>
lea    0xe4e(%rip),%rdi
call   1050 <puts@plt>
lea    0xe90(%rip),%rdi
call   1050 <puts@plt>
lea    0xe9d(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebp
jmp    1294 <main+0x124>
call   1030 <RSA_Encrypt@plt>
mov    %ebp,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [58 x i8] c"\0AUsage: makeDES <flag> <Source file> <Object file> <key>\0A\00"
@.str.1 = [79 x i8] c"flag -- \E6\A0\87\E8\AF\86\EF\BC\8C\E4\B8\BA1\E6\97\B6\E8\BF\9B\E8\A1\8C\E5\8A\A0\E5\AF\86\E6\93\8D\E4\BD\9C\EF\BC\8C\E4\B8\BA2\E6\97\B6\E8\BF\9B\E8\A1\8C\E8\A7\A3\E5\AF\86\E6\93\8D\E4\BD\9C\0A\00"
@.str.2 = [26 x i8] c"Source file -- \E6\BA\90\E6\96\87\E4\BB\B6\0A\00"
@.str.3 = [29 x i8] c"Object file -- \E7\9B\AE\E6\A0\87\E6\96\87\E4\BB\B6\0A\00"
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [46 x i8] c"\0A\E6\82\A8\E9\80\89\E6\8B\A9\E7\9A\84\E6\96\B9\E5\BC\8F\E6\98\AF[flag=%s],\E5\8A\A0\E5\AF\86\E6\93\8D\E4\BD\9C\0A\00"
@.str.6 = [46 x i8] c"\0A\E6\82\A8\E9\80\89\E6\8B\A9\E7\9A\84\E6\96\B9\E5\BC\8F\E6\98\AF[flag=%s],\E8\A7\A3\E5\AF\86\E6\93\8D\E4\BD\9C\0A\00"
@.str.7 = [17 x i8] c"Source file: %s\0A\00"
@.str.8 = [17 x i8] c"Object file: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i8]
%7 = alloca [32 x i8]
%8 = alloca [32 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 4
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %64
16: ; preds = %2
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%18 = call i32 @bzero(i8* %17, i32 5)
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%20 = call i32 @bzero(i8* %19, i32 32)
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%22 = call i32 @bzero(i8* %21, i32 32)
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @strcpy(i8* %23, i8* %26)
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @strcpy(i8* %28, i8* %31)
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @strcpy(i8* %33, i8* %36)
%38 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %16
%42 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* %42)
br label %47
44: ; preds = %16
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %44, %41
%48 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %48)
%50 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %50)
%52 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %47
%56 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%57 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%58 = call i32 @RSA_Encrypt(i8* %56, i8* %57)
br label %63
59: ; preds = %47
%60 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%61 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%62 = call i32 @RSA_Decrypt(i8* %60, i8* %61)
br label %63
63: ; preds = %59, %55
store i32 0, i32* %3
br label %64
64: ; preds = %63, %11
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [46 x i8] c"\0A\E6\82\A8\E9\80\89\E6\8B\A9\E7\9A\84\E6\96\B9\E5\BC\8F\E6\98\AF[flag=%s],\E5\8A\A0\E5\AF\86\E6\93\8D\E4\BD\9C\0A\00"
@.str.6 = [46 x i8] c"\0A\E6\82\A8\E9\80\89\E6\8B\A9\E7\9A\84\E6\96\B9\E5\BC\8F\E6\98\AF[flag=%s],\E8\A7\A3\E5\AF\86\E6\93\8D\E4\BD\9C\0A\00"
@.str.7 = [17 x i8] c"Source file: %s\0A\00"
@.str.8 = [17 x i8] c"Object file: %s\0A\00"
@str = [57 x i8] c"\0AUsage: makeDES <flag> <Source file> <Object file> <key>\00"
@str.9 = [78 x i8] c"flag -- \E6\A0\87\E8\AF\86\EF\BC\8C\E4\B8\BA1\E6\97\B6\E8\BF\9B\E8\A1\8C\E5\8A\A0\E5\AF\86\E6\93\8D\E4\BD\9C\EF\BC\8C\E4\B8\BA2\E6\97\B6\E8\BF\9B\E8\A1\8C\E8\A7\A3\E5\AF\86\E6\93\8D\E4\BD\9C\00"
@str.10 = [25 x i8] c"Source file -- \E6\BA\90\E6\96\87\E4\BB\B6\00"
@str.11 = [28 x i8] c"Object file -- \E7\9B\AE\E6\A0\87\E6\96\87\E4\BB\B6\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [5 x i8]
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 4
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.9, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
br label %40
15: ; preds = %2
%16 = call i32 @bzero(i8* %6, i32 5)
%17 = call i32 @bzero(i8* %7, i32 32)
%18 = call i32 @bzero(i8* %8, i32 32)
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strcpy(i8* %6, i8* %20)
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @strcpy(i8* %7, i8* %23)
%25 = getelementptr inbounds i8*, i8** %1, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @strcpy(i8* %8, i8* %26)
%28 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %30, i8* %6)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %7)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %8)
%34 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %15
%37 = call i32 @RSA_Encrypt(i8* %7, i8* %8)
br label %40
38: ; preds = %15
%39 = call i32 @RSA_Decrypt(i8* %7, i8* %8)
br label %40
40: ; preds = %36, %38, %10
%41 = phi i32 [ 1, %10 ], [ 0, %38 ], [ 0, %36 ]
ret i32 %41
}