#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*/ RSA;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *EVP_des_ede3_cbc();
int PEM_write_RSAPrivateKey(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                            int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                            int /*<<< orphan*/, int /*<<< orphan*/ *,
                            int /*<<< orphan*/ *);
int PEM_write_RSAPublicKey(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *RSA_generate_key(int, int, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  RSA *r = NULL;
  FILE *priv_output_file;
  FILE *pub_output_file;
  int key_len;
  char *priv_file_name;
  char *pub_file_name;
  char priv_suffix[] = ".priv";
  char pub_suffix[] = ".pub";
  int len;
  if (argc != 4) {
    printf("Usage %s <key_file> <keylen> <password protect flag>\n", argv[0]);
    exit(0);
  }
  priv_file_name = malloc(40);
  pub_file_name = malloc(40);
  len = strlen(argv[1]);
  memcpy(priv_file_name, argv[1], len);
  memcpy(pub_file_name, argv[1], len);
  memcpy(priv_file_name + len, priv_suffix, 10);
  memcpy(pub_file_name + len, pub_suffix, 9);
  printf("%s %s\n", priv_file_name, pub_file_name);
  key_len = atoi(argv[2]);
  r = RSA_generate_key(key_len, 3, NULL, NULL);
  if ((priv_output_file = fopen(priv_file_name, "w")) == NULL)
    fprintf(stderr, "Cannot open %s\n", argv[1]);
  if ((pub_output_file = fopen(pub_file_name, "w")) == NULL)
    fprintf(stderr, "Cannot open %s\n", argv[1]);
  if (strcmp(argv[3], "0") == 0) {
    if (PEM_write_RSAPrivateKey(priv_output_file, r, EVP_des_ede3_cbc(), NULL,
                                0, NULL, NULL) != 1) {
      printf("Error writing the private key\n");
    }
  } else {
    if (PEM_write_RSAPrivateKey(priv_output_file, r, NULL, NULL, 0, NULL,
                                NULL) != 1) {
      printf("Error writing the private key\n");
    }
  }
  if (PEM_write_RSAPublicKey(pub_output_file, r) != 1) {
    printf("Error writing the public key\n");
  }
  fclose(priv_output_file);
  fclose(pub_output_file);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0xdfc(%rip),%eax
mov    %eax,-0x46(%rbp)
mov    0xdf6(%rip),%ax
mov    %ax,-0x42(%rbp)
mov    0xdee(%rip),%eax
mov    %eax,-0x4b(%rbp)
mov    0xde9(%rip),%al
mov    %al,-0x47(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     124a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    $0x28,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x28,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x50(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x50(%rbp),%edx
call   10a0 <memcpy@plt>
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x50(%rbp),%edx
call   10a0 <memcpy@plt>
mov    -0x38(%rbp),%rdi
movslq -0x50(%rbp),%rax
add    %rax,%rdi
lea    -0x46(%rbp),%rsi
mov    $0xa,%edx
call   10a0 <memcpy@plt>
mov    -0x40(%rbp),%rdi
movslq -0x50(%rbp),%rax
add    %rax,%rdi
lea    -0x4b(%rbp),%rsi
mov    $0x9,%edx
call   10a0 <memcpy@plt>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x3,%esi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1100 <RSA_generate_key@plt>
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xd2f(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1349 <main+0x169>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd06(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xcf4(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1384 <main+0x1a4>
mov    0x2c72(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xccb(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xcc7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13f8 <main+0x218>
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    $0x0,%al
call   10c0 <EVP_des_ede3_cbc@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    %rax,%rdx
xor    %eax,%eax
mov    %eax,%r9d
xor    %r8d,%r8d
mov    %r9,%rcx
movq   $0x0,(%rsp)
call   1030 <PEM_write_RSAPrivateKey@plt>
cmp    $0x1,%eax
je     13f3 <main+0x213>
lea    0xc70(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1437 <main+0x257>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r9d
xor    %r8d,%r8d
mov    %r9,%rdx
mov    %r9,%rcx
movq   $0x0,(%rsp)
call   1030 <PEM_write_RSAPrivateKey@plt>
cmp    $0x1,%eax
je     1432 <main+0x252>
lea    0xc31(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1437 <main+0x257>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <PEM_write_RSAPublicKey@plt>
cmp    $0x1,%eax
je     145b <main+0x27b>
lea    0xc27(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
movw   $0x76,0x1c(%rsp)
movl   $0x6972702e,0x18(%rsp)
69
movb   $0x0,0x14(%rsp)
movl   $0x6275702e,0x10(%rsp)
62
cmp    $0x4,%edi
jne    134f <main+0x15f>
mov    $0x28,%edi
call   10c0 <malloc@plt>
mov    %rax,%r14
mov    $0x28,%edi
call   10c0 <malloc@plt>
mov    %rax,%r12
mov    0x8(%rbx),%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   10b0 <memcpy@plt>
mov    0x8(%rbx),%rsi
mov    %r12,%rdi
mov    %ebp,%edx
call   10b0 <memcpy@plt>
movslq %ebp,%rbp
lea    (%r14,%rbp,1),%rdi
lea    0x18(%rsp),%rsi
mov    $0xa,%edx
call   10b0 <memcpy@plt>
add    %r12,%rbp
lea    0x10(%rsp),%rsi
mov    %rbp,%rdi
mov    $0x9,%edx
call   10b0 <memcpy@plt>
lea    0xdaa(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x10(%rbx),%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
mov    $0x3,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1110 <RSA_generate_key@plt>
mov    %rax,%r15
lea    0xd81(%rip),%rsi
mov    %r14,%rdi
call   10e0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    12f0 <main+0x100>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd5f(%rip),%rsi
call   10a0 <fprintf@plt>
lea    0xd51(%rip),%rsi
mov    %r12,%rdi
call   10e0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    1320 <main+0x130>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd2f(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x18(%rbx),%rdi
lea    0xd2f(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1367 <main+0x177>
xor    %eax,%eax
call   10d0 <EVP_des_ede3_cbc@plt>
movq   $0x0,(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
jmp    1377 <main+0x187>
mov    (%rbx),%rsi
lea    0xcb2(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
movq   $0x0,(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <PEM_write_RSAPrivateKey@plt>
cmp    $0x1,%eax
je     1395 <main+0x1a5>
lea    0xce9(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1090 <PEM_write_RSAPublicKey@plt>
cmp    $0x1,%eax
je     13b1 <main+0x1c1>
lea    0xcb0(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@__const.main.priv_suffix = [6 x i8] c".priv\00"
@__const.main.pub_suffix = [5 x i8] c".pub\00"
@.str = [54 x i8] c"Usage %s <key_file> <keylen> <password protect flag>\0A\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
@.str.2 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.3 = [16 x i8] c"Cannot open %s\0A\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [31 x i8] c"Error writing the private key\0A\00"
@.str.6 = [30 x i8] c"Error writing the public key\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [6 x i8]
%13 = alloca [5 x i8]
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
%15 = bitcast [6 x i8]* %12 to i8*
%16 = bitcast [5 x i8]* %13 to i8*
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 4
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = call i32 @exit(i32 0)
unreachable
25: ; preds = %2
%26 = call i8* @malloc(i32 40)
store i8* %26, i8** %10
%27 = call i8* @malloc(i32 40)
store i8* %27, i8** %11
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strlen(i8* %30)
store i32 %31, i32* %14
%32 = load i8*, i8** %10
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = load i32, i32* %14
%37 = call i32 @memcpy(i8* %32, i8* %35, i32 %36)
%38 = load i8*, i8** %11
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = load i32, i32* %14
%43 = call i32 @memcpy(i8* %38, i8* %41, i32 %42)
%44 = load i8*, i8** %10
%45 = load i32, i32* %14
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = getelementptr inbounds [6 x i8], [6 x i8]* %12, i64 0, i64 0
%49 = call i32 @memcpy(i8* %47, i8* %48, i32 10)
%50 = load i8*, i8** %11
%51 = load i32, i32* %14
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
%54 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%55 = call i32 @memcpy(i8* %53, i8* %54, i32 9)
%56 = load i8*, i8** %10
%57 = load i8*, i8** %11
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %56, i8* %57)
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 2
%61 = load i8*, i8** %60
%62 = call i32 @atoi(i8* %61)
store i32 %62, i32* %9
%63 = load i32, i32* %9
%64 = call i32* @RSA_generate_key(i32 %63, i32 3, i32* null, i32* null)
store i32* %64, i32** %6
%65 = load i8*, i8** %10
%66 = call i32* @fopen(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %66, i32** %7
%67 = icmp eq i32* %66, null
br i1 %67, label %68, label %74
68: ; preds = %25
%69 = load i32, i32* @stderr
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %72)
br label %74
74: ; preds = %68, %25
%75 = load i8*, i8** %11
%76 = call i32* @fopen(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %76, i32** %8
%77 = icmp eq i32* %76, null
br i1 %77, label %78, label %84
78: ; preds = %74
%79 = load i32, i32* @stderr
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 1
%82 = load i8*, i8** %81
%83 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %82)
br label %84
84: ; preds = %78, %74
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 3
%87 = load i8*, i8** %86
%88 = call i64 @strcmp(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %99
90: ; preds = %84
%91 = load i32*, i32** %7
%92 = load i32*, i32** %6
%93 = call i32* (...) @EVP_des_ede3_cbc()
%94 = call i32 @PEM_write_RSAPrivateKey(i32* %91, i32* %92, i32* %93, i32* null, i32 0, i32* null, i32* null)
%95 = icmp ne i32 %94, 1
br i1 %95, label %96, label %98
96: ; preds = %90
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %98
98: ; preds = %96, %90
br label %107
99: ; preds = %84
%100 = load i32*, i32** %7
%101 = load i32*, i32** %6
%102 = call i32 @PEM_write_RSAPrivateKey(i32* %100, i32* %101, i32* null, i32* null, i32 0, i32* null, i32* null)
%103 = icmp ne i32 %102, 1
br i1 %103, label %104, label %106
104: ; preds = %99
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %106
106: ; preds = %104, %99
br label %107
107: ; preds = %106, %98
%108 = load i32*, i32** %8
%109 = load i32*, i32** %6
%110 = call i32 @PEM_write_RSAPublicKey(i32* %108, i32* %109)
%111 = icmp ne i32 %110, 1
br i1 %111, label %112, label %114
112: ; preds = %107
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
br label %114
114: ; preds = %112, %107
%115 = load i32*, i32** %7
%116 = call i32 @fclose(i32* %115)
%117 = load i32*, i32** %8
%118 = call i32 @fclose(i32* %117)
%119 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@__const.main.priv_suffix = [6 x i8] c".priv\00"
@__const.main.pub_suffix = [5 x i8] c".pub\00"
@.str = [54 x i8] c"Usage %s <key_file> <keylen> <password protect flag>\0A\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
@.str.2 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.3 = [16 x i8] c"Cannot open %s\0A\00"
@.str.4 = [2 x i8] c"0\00"
@str = [29 x i8] c"Error writing the public key\00"
@str.8 = [30 x i8] c"Error writing the private key\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [6 x i8]
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 4
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = tail call dereferenceable_or_null(40) i8* @malloc(i32 40)
%14 = tail call dereferenceable_or_null(40) i8* @malloc(i32 40)
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @strlen(i8* %16)
%18 = load i8*, i8** %15
%19 = tail call i32 @memcpy(i8* %13, i8* %18, i32 %17)
%20 = load i8*, i8** %15
%21 = tail call i32 @memcpy(i8* %14, i8* %20, i32 %17)
%22 = sext i32 %17 to i64
%23 = getelementptr inbounds i8, i8* %13, i64 %22
%24 = call i32 @memcpy(i8* %23, i8* %5, i32 10)
%25 = getelementptr inbounds i8, i8* %14, i64 %22
%26 = call i32 @memcpy(i8* %25, i8* %6, i32 9)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
%31 = call i32* @RSA_generate_key(i32 %30, i32 3, i32* null, i32* null)
%32 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %38
34: ; preds = %12
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %15
%37 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %34, %12
%39 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %45
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %15
%44 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %41, %38
%46 = getelementptr inbounds i8*, i8** %1, i64 3
%47 = load i8*, i8** %46
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %45
%51 = call i32* (...) @EVP_des_ede3_cbc()
%52 = call i32 @PEM_write_RSAPrivateKey(i32* %32, i32* %31, i32* %51, i32* null, i32 0, i32* null, i32* null)
%53 = icmp eq i32 %52, 1
br i1 %53, label %60, label %57
54: ; preds = %45
%55 = call i32 @PEM_write_RSAPrivateKey(i32* %32, i32* %31, i32* null, i32* null, i32 0, i32* null, i32* null)
%56 = icmp eq i32 %55, 1
br i1 %56, label %60, label %57
57: ; preds = %54, %50
%58 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.8, i64 0, i64 0), %50 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.8, i64 0, i64 0), %54 ]
%59 = call i32 @puts(i8* dereferenceable(1) %58)
br label %60
60: ; preds = %57, %54, %50
%61 = call i32 @PEM_write_RSAPublicKey(i32* %39, i32* %31)
%62 = icmp eq i32 %61, 1
br i1 %62, label %65, label %63
63: ; preds = %60
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %65
65: ; preds = %63, %60
%66 = call i32 @fclose(i32* %32)
%67 = call i32 @fclose(i32* %39)
%68 = call i32 @exit(i32 0)
unreachable
}