#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*/ enc;
typedef int /*<<< orphan*/ dec;
typedef int /*<<< orphan*/ data;
typedef int /*<<< orphan*/ EVP_PKEY_CTX;
typedef int /*<<< orphan*/ EVP_PKEY;
typedef int /*<<< orphan*/ ENGINE;

/* Variables and functions */
int CONF_modules_load_file(char const *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ CONF_modules_unload(int);
int /*<<< orphan*/ ENGINE_add_conf_module();
int /*<<< orphan*/ *ENGINE_by_id(char *);
int /*<<< orphan*/ ENGINE_ctrl_cmd_string(int /*<<< orphan*/ *, char *,
                                          char const *, int /*<<< orphan*/);
int /*<<< orphan*/ ENGINE_finish(int /*<<< orphan*/ *);
int /*<<< orphan*/ ENGINE_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ ENGINE_load_builtin_engines();
int /*<<< orphan*/ *ENGINE_load_private_key(int /*<<< orphan*/ *, char *,
                                            int /*<<< orphan*/ *,
                                            int /*<<< orphan*/ *);
int /*<<< orphan*/ *ENGINE_load_public_key(int /*<<< orphan*/ *, char *,
                                           int /*<<< orphan*/ *,
                                           int /*<<< orphan*/ *);
int /*<<< orphan*/ ERR_clear_error();
int /*<<< orphan*/ ERR_load_crypto_strings();
int /*<<< orphan*/ EVP_PKEY_CTX_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_CTX_new(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
scalar_t__ EVP_PKEY_CTX_set_rsa_padding(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/);
int EVP_PKEY_decrypt(int /*<<< orphan*/ *, unsigned char *, size_t *,
                     unsigned char *, size_t);
scalar_t__ EVP_PKEY_decrypt_init(int /*<<< orphan*/ *);
scalar_t__ EVP_PKEY_encrypt(int /*<<< orphan*/ *, unsigned char *, size_t *,
                            unsigned char *, size_t);
scalar_t__ EVP_PKEY_encrypt_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
int /*<<< orphan*/ RAND_bytes(unsigned char *, size_t);
int /*<<< orphan*/ RSA_PKCS1_OAEP_PADDING;
int /*<<< orphan*/ display_openssl_errors(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memcmp(unsigned char *, unsigned char *, size_t);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  EVP_PKEY *private_key, *public_key;
  EVP_PKEY_CTX *pkey_ctx;
  char *private_key_name, *public_key_name;
  unsigned char data[32];
  size_t data_len;
  unsigned char dec[4096];
  size_t dec_len;
  unsigned char enc[4096];
  size_t enc_len;
  char *key_pass = NULL;
  const char *module_path, *efile;
  ENGINE *e;
  int ret;
  if (argc < 5) {
    fprintf(
        stderr,
        "usage: %s [PIN] [CONF] [private key URL] [public key URL] [module]\n",
        argv[0]);
    fprintf(stderr, "\n");
    exit(1);
  }
  key_pass = argv[1];
  efile = argv[2];
  private_key_name = argv[3];
  public_key_name = argv[4];
  module_path = argv[5];
  ret = CONF_modules_load_file(efile, "engines", 0);
  if (ret <= 0) {
    fprintf(stderr, "cannot load %s\n", efile);
    display_openssl_errors(94);
    exit(1);
  }
  ENGINE_add_conf_module();
  OpenSSL_add_all_algorithms();
  ERR_load_crypto_strings();
  ERR_clear_error();
  ENGINE_load_builtin_engines();
  e = ENGINE_by_id("pkcs11");
  if (e == NULL) {
    display_openssl_errors(112);
    exit(1);
  }
  if (!ENGINE_ctrl_cmd_string(e, "VERBOSE", NULL, 0)) {
    display_openssl_errors(117);
    exit(1);
  }
  if (!ENGINE_ctrl_cmd_string(e, "MODULE_PATH", module_path, 0)) {
    display_openssl_errors(122);
    exit(1);
  }
  if (!ENGINE_init(e)) {
    display_openssl_errors(127);
    exit(1);
  }
  if (key_pass && !ENGINE_ctrl_cmd_string(e, "PIN", key_pass, 0)) {
    display_openssl_errors(132);
    exit(1);
  }
  private_key = ENGINE_load_private_key(e, private_key_name, NULL, NULL);
  if (private_key == NULL) {
    fprintf(stderr, "cannot load: %s\n", private_key_name);
    display_openssl_errors(139);
    exit(1);
  }
  public_key = ENGINE_load_public_key(e, public_key_name, NULL, NULL);
  if (public_key == NULL) {
    fprintf(stderr, "cannot load: %s\n", public_key_name);
    display_openssl_errors(146);
    exit(1);
  }
  data_len = sizeof(data);
  if (!RAND_bytes(data, data_len)) {
    display_openssl_errors(153);
    exit(1);
  }
  pkey_ctx = EVP_PKEY_CTX_new(public_key, e);
  if (pkey_ctx == NULL) {
    fprintf(stderr, "Could not create context\n");
    display_openssl_errors(162);
    exit(1);
  }
  if (EVP_PKEY_encrypt_init(pkey_ctx) <= 0) {
    fprintf(stderr, "Could not init encryption\n");
    display_openssl_errors(168);
    exit(1);
  }
  if (EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, RSA_PKCS1_OAEP_PADDING) <= 0) {
    fprintf(stderr, "Could not set padding\n");
    display_openssl_errors(174);
    exit(1);
  }
  enc_len = sizeof(enc);
  if (EVP_PKEY_encrypt(pkey_ctx, enc, &enc_len, data, data_len) <= 0) {
    display_openssl_errors(180);
    exit(1);
  }
  EVP_PKEY_CTX_free(pkey_ctx);
  printf("Data encrypted\n");
  pkey_ctx = EVP_PKEY_CTX_new(private_key, e);
  if (pkey_ctx == NULL) {
    fprintf(stderr, "Could not create context\n");
    display_openssl_errors(194);
    exit(1);
  }
  if (EVP_PKEY_decrypt_init(pkey_ctx) <= 0) {
    fprintf(stderr, "Could not init decryption\n");
    display_openssl_errors(200);
    exit(1);
  }
  if (EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, RSA_PKCS1_OAEP_PADDING) <= 0) {
    fprintf(stderr, "Could not set padding\n");
    display_openssl_errors(206);
    exit(1);
  }
  ret = EVP_PKEY_decrypt(pkey_ctx, NULL, &dec_len, enc, enc_len);
  if (ret < 0) {
    display_openssl_errors(213);
    exit(1);
  }
  if (dec_len > sizeof(dec)) {
    fprintf(stderr, "Buffer too small to hold decrypted data\n");
    exit(1);
  }
  ret = EVP_PKEY_decrypt(pkey_ctx, dec, &dec_len, enc, enc_len);
  if (ret < 0) {
    display_openssl_errors(224);
    exit(1);
  }
  EVP_PKEY_CTX_free(pkey_ctx);
  if (!memcmp(dec, data, data_len)) {
    printf("Sucessfuly decrypted\n");
  } else {
    printf("Decrypted data does not match original data\n");
    display_openssl_errors(237);
    exit(1);
  }
  ENGINE_finish(e);
  CONF_modules_unload(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x2090(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    130d <main+0x6d>
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd1b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    0xd46(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x2090(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20a0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x2098(%rbp)
mov    -0x20a0(%rbp),%rdi
lea    0xce4(%rip),%rsi
xor    %edx,%edx
call   1050 <CONF_modules_load_file@plt>
mov    %eax,-0x20ac(%rbp)
cmpl   $0x0,-0x20ac(%rbp)
jg     13ac <main+0x10c>
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
mov    -0x20a0(%rbp),%rdx
lea    0xcbb(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x5e,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    $0x0,%al
call   1120 <ENGINE_add_conf_module@plt>
mov    $0x0,%al
call   10e0 <OpenSSL_add_all_algorithms@plt>
mov    $0x0,%al
call   1160 <ERR_load_crypto_strings@plt>
mov    $0x0,%al
call   10f0 <ERR_clear_error@plt>
mov    $0x0,%al
call   1180 <ENGINE_load_builtin_engines@plt>
lea    0xc86(%rip),%rdi
call   11c0 <ENGINE_by_id@plt>
mov    %rax,-0x20a8(%rbp)
cmpq   $0x0,-0x20a8(%rbp)
jne    1404 <main+0x164>
mov    $0x70,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20a8(%rbp),%rdi
lea    0xc51(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <ENGINE_ctrl_cmd_string@plt>
cmp    $0x0,%eax
jne    143a <main+0x19a>
mov    $0x75,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20a8(%rbp),%rdi
mov    -0x2098(%rbp),%rdx
lea    0xc1c(%rip),%rsi
xor    %ecx,%ecx
call   1070 <ENGINE_ctrl_cmd_string@plt>
cmp    $0x0,%eax
jne    1473 <main+0x1d3>
mov    $0x7a,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20a8(%rbp),%rdi
call   1060 <ENGINE_init@plt>
cmp    $0x0,%eax
jne    149c <main+0x1fc>
mov    $0x7f,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
cmpq   $0x0,-0x2090(%rbp)
je     14e3 <main+0x243>
mov    -0x20a8(%rbp),%rdi
mov    -0x2090(%rbp),%rdx
lea    0xbb8(%rip),%rsi
xor    %ecx,%ecx
call   1070 <ENGINE_ctrl_cmd_string@plt>
cmp    $0x0,%eax
jne    14e3 <main+0x243>
mov    $0x84,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20a8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   11a0 <ENGINE_load_private_key@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1538 <main+0x298>
mov    0x2ac8(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xb5e(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x8b,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20a8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1190 <ENGINE_load_public_key@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    158d <main+0x2ed>
mov    0x2a73(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xb09(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x92,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
movq   $0x20,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1080 <RAND_bytes@plt>
cmp    $0x0,%eax
jne    15bf <main+0x31f>
mov    $0x99,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x20a8(%rbp),%rsi
call   1030 <EVP_PKEY_CTX_new@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1609 <main+0x369>
mov    0x29f3(%rip),%rax
mov    (%rax),%edi
lea    0xa9e(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xa2,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
call   1040 <EVP_PKEY_encrypt_init@plt>
cmp    $0x0,%rax
jg     1647 <main+0x3a7>
mov    0x29b5(%rip),%rax
mov    (%rax),%edi
lea    0xa7a(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xa8,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    0x2996(%rip),%rax
mov    (%rax),%esi
call   1140 <EVP_PKEY_CTX_set_rsa_padding@plt>
cmp    $0x0,%rax
jg     168e <main+0x3ee>
mov    0x296e(%rip),%rax
mov    (%rax),%edi
lea    0xa4e(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xae,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
movq   $0x1000,-0x2088(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x2080(%rbp),%rsi
lea    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
lea    -0x2088(%rbp),%rdx
call   1110 <EVP_PKEY_encrypt@plt>
cmp    $0x0,%rax
jg     16d6 <main+0x436>
mov    $0xb4,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
call   11b0 <EVP_PKEY_CTX_free@plt>
lea    0x9f2(%rip),%rdi
call   1090 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20a8(%rbp),%rsi
call   1030 <EVP_PKEY_CTX_new@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1735 <main+0x495>
mov    0x28c7(%rip),%rax
mov    (%rax),%edi
lea    0x972(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xc2,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
call   1150 <EVP_PKEY_decrypt_init@plt>
cmp    $0x0,%rax
jg     1773 <main+0x4d3>
mov    0x2889(%rip),%rax
mov    (%rax),%edi
lea    0x990(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xc8,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    0x286a(%rip),%rax
mov    (%rax),%esi
call   1140 <EVP_PKEY_CTX_set_rsa_padding@plt>
cmp    $0x0,%rax
jg     17ba <main+0x51a>
mov    0x2842(%rip),%rax
mov    (%rax),%edi
lea    0x922(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xce,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    -0x2080(%rbp),%rcx
mov    -0x2088(%rbp),%r8
xor    %eax,%eax
mov    %eax,%esi
lea    -0x1078(%rbp),%rdx
call   10a0 <EVP_PKEY_decrypt@plt>
mov    %eax,-0x20ac(%rbp)
cmpl   $0x0,-0x20ac(%rbp)
jge    1803 <main+0x563>
mov    $0xd5,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
cmpq   $0x1000,-0x1078(%rbp)
jbe    1835 <main+0x595>
mov    0x27bd(%rip),%rax
mov    (%rax),%edi
lea    0x8df(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    -0x1070(%rbp),%rsi
lea    -0x2080(%rbp),%rcx
mov    -0x2088(%rbp),%r8
lea    -0x1078(%rbp),%rdx
call   10a0 <EVP_PKEY_decrypt@plt>
mov    %eax,-0x20ac(%rbp)
cmpl   $0x0,-0x20ac(%rbp)
jge    1881 <main+0x5e1>
mov    $0xe0,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x28(%rbp),%rdi
call   11b0 <EVP_PKEY_CTX_free@plt>
lea    -0x1070(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rdx
call   10c0 <memcmp@plt>
cmp    $0x0,%eax
jne    18b8 <main+0x618>
lea    0x87e(%rip),%rdi
call   1090 <printf@plt>
jmp    18d8 <main+0x638>
lea    0x883(%rip),%rdi
call   1090 <printf@plt>
mov    $0xed,%edi
call   1130 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20a8(%rbp),%rdi
call   1100 <ENGINE_finish@plt>
mov    $0x1,%edi
call   10b0 <CONF_modules_unload@plt>
xor    %eax,%eax
add    $0x20b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2038,%rsp
cmp    $0x4,%edi
jle    1546 <main+0x2b6>
mov    0x8(%rsi),%r12
mov    0x10(%rsi),%rbx
mov    0x18(%rsi),%r15
mov    0x20(%rsi),%r14
mov    0x28(%rsi),%r13
lea    0xd7f(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1050 <CONF_modules_load_file@plt>
test   %eax,%eax
jle    156e <main+0x2de>
xor    %eax,%eax
call   1110 <ENGINE_add_conf_module@plt>
xor    %eax,%eax
call   10d0 <OpenSSL_add_all_algorithms@plt>
xor    %eax,%eax
call   1150 <ERR_load_crypto_strings@plt>
xor    %eax,%eax
call   10e0 <ERR_clear_error@plt>
xor    %eax,%eax
call   1170 <ENGINE_load_builtin_engines@plt>
lea    0xd5b(%rip),%rdi
call   11b0 <ENGINE_by_id@plt>
test   %rax,%rax
je     1592 <main+0x302>
mov    %rax,%rbp
lea    0xd4a(%rip),%rsi
mov    %rax,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1080 <ENGINE_ctrl_cmd_string@plt>
test   %eax,%eax
je     159c <main+0x30c>
lea    0xd37(%rip),%rsi
mov    %rbp,%rdi
mov    %r13,%rdx
xor    %ecx,%ecx
call   1080 <ENGINE_ctrl_cmd_string@plt>
test   %eax,%eax
je     15a6 <main+0x316>
mov    %rbp,%rdi
call   1070 <ENGINE_init@plt>
test   %eax,%eax
je     15b0 <main+0x320>
test   %r12,%r12
je     137a <main+0xea>
lea    0xd12(%rip),%rsi
mov    %rbp,%rdi
mov    %r12,%rdx
xor    %ecx,%ecx
call   1080 <ENGINE_ctrl_cmd_string@plt>
test   %eax,%eax
je     1718 <main+0x488>
mov    %rbp,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1190 <ENGINE_load_private_key@plt>
test   %rax,%rax
je     15ba <main+0x32a>
mov    %rax,%r12
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1180 <ENGINE_load_public_key@plt>
test   %rax,%rax
je     15de <main+0x34e>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
mov    $0x20,%esi
call   1090 <RAND_bytes@plt>
test   %eax,%eax
je     1602 <main+0x372>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <EVP_PKEY_CTX_new@plt>
test   %rax,%rax
je     160c <main+0x37c>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <EVP_PKEY_encrypt_init@plt>
test   %rax,%rax
jle    162d <main+0x39d>
mov    0x2bf2(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   1130 <EVP_PKEY_CTX_set_rsa_padding@plt>
test   %rax,%rax
jle    164e <main+0x3be>
movq   $0x1000,(%rsp)
lea    0x30(%rsp),%rsi
mov    %rsp,%rdx
lea    0x10(%rsp),%rcx
mov    $0x20,%r8d
mov    %rbx,%rdi
call   1100 <EVP_PKEY_encrypt@plt>
test   %rax,%rax
jle    166f <main+0x3df>
mov    %rbx,%rdi
call   11a0 <EVP_PKEY_CTX_free@plt>
lea    0xcd7(%rip),%rdi
call   1060 <puts@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1030 <EVP_PKEY_CTX_new@plt>
test   %rax,%rax
je     1679 <main+0x3e9>
mov    %rax,%rbx
mov    %rax,%rdi
call   1140 <EVP_PKEY_decrypt_init@plt>
test   %rax,%rax
jle    169a <main+0x40a>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1130 <EVP_PKEY_CTX_set_rsa_padding@plt>
test   %rax,%rax
jle    16b8 <main+0x428>
mov    (%rsp),%r8
lea    0x8(%rsp),%rdx
lea    0x30(%rsp),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <EVP_PKEY_decrypt@plt>
test   %eax,%eax
js     16d6 <main+0x446>
cmpq   $0x1001,0x8(%rsp)
jae    16dd <main+0x44d>
mov    (%rsp),%r8
lea    0x1030(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x30(%rsp),%rcx
mov    %rbx,%rdi
call   10a0 <EVP_PKEY_decrypt@plt>
test   %eax,%eax
js     16fe <main+0x46e>
mov    %rbx,%rdi
call   11a0 <EVP_PKEY_CTX_free@plt>
movdqa 0x1030(%rsp),%xmm0
movdqa 0x1040(%rsp),%xmm1
pcmpeqb 0x20(%rsp),%xmm1
pcmpeqb 0x10(%rsp),%xmm0
pand   %xmm1,%xmm0
pmovmskb %xmm0,%eax
cmp    $0xffff,%eax
jne    1705 <main+0x475>
lea    0xc10(%rip),%rdi
call   1060 <puts@plt>
mov    %rbp,%rdi
call   10f0 <ENGINE_finish@plt>
mov    $0x1,%edi
call   10b0 <CONF_modules_unload@plt>
xor    %eax,%eax
add    $0x2038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a8b(%rip),%rbx
mov    (%rbx),%edi
mov    (%rsi),%rdx
lea    0xaa7(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xad9(%rip),%rsi
jmp    16ed <main+0x45d>
mov    0x2a63(%rip),%rax
mov    (%rax),%edi
lea    0xace(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x5e,%edi
jmp    171d <main+0x48d>
mov    $0x70,%edi
jmp    171d <main+0x48d>
mov    $0x75,%edi
jmp    171d <main+0x48d>
mov    $0x7a,%edi
jmp    171d <main+0x48d>
mov    $0x7f,%edi
jmp    171d <main+0x48d>
mov    0x2a17(%rip),%rax
mov    (%rax),%edi
lea    0xab1(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x8b,%edi
jmp    171d <main+0x48d>
mov    0x29f3(%rip),%rax
mov    (%rax),%edi
lea    0xa8d(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x92,%edi
jmp    171d <main+0x48d>
mov    $0x99,%edi
jmp    171d <main+0x48d>
mov    0x29c5(%rip),%rax
mov    (%rax),%edi
lea    0xa70(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0xa2,%edi
jmp    171d <main+0x48d>
mov    0x29a4(%rip),%rax
mov    (%rax),%edi
lea    0xa69(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0xa8,%edi
jmp    171d <main+0x48d>
mov    0x2983(%rip),%rax
mov    (%rax),%edi
lea    0xa63(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0xae,%edi
jmp    171d <main+0x48d>
mov    $0xb4,%edi
jmp    171d <main+0x48d>
mov    0x2958(%rip),%rax
mov    (%rax),%edi
lea    0xa03(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0xc2,%edi
jmp    171d <main+0x48d>
mov    0x2937(%rip),%rax
mov    (%rax),%edi
lea    0xa2e(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0xc8,%edi
jmp    171d <main+0x48d>
mov    0x2919(%rip),%rax
mov    (%rax),%edi
lea    0x9f9(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0xce,%edi
jmp    171d <main+0x48d>
mov    $0xd5,%edi
jmp    171d <main+0x48d>
mov    0x28f4(%rip),%rax
mov    (%rax),%edi
lea    0xa06(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    $0xe0,%edi
jmp    171d <main+0x48d>
lea    0xa34(%rip),%rdi
call   1060 <puts@plt>
mov    $0xed,%edi
jmp    171d <main+0x48d>
mov    $0x84,%edi
call   1120 <display_openssl_errors@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [68 x i8] c"usage: %s [PIN] [CONF] [private key URL] [public key URL] [module]\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [8 x i8] c"engines\00"
@.str.3 = [16 x i8] c"cannot load %s\0A\00"
@.str.4 = [7 x i8] c"pkcs11\00"
@.str.5 = [8 x i8] c"VERBOSE\00"
@.str.6 = [12 x i8] c"MODULE_PATH\00"
@.str.7 = [4 x i8] c"PIN\00"
@.str.8 = [17 x i8] c"cannot load: %s\0A\00"
@.str.9 = [26 x i8] c"Could not create context\0A\00"
@.str.10 = [27 x i8] c"Could not init encryption\0A\00"
@RSA_PKCS1_OAEP_PADDING = global i32 0
@.str.11 = [23 x i8] c"Could not set padding\0A\00"
@.str.12 = [16 x i8] c"Data encrypted\0A\00"
@.str.13 = [27 x i8] c"Could not init decryption\0A\00"
@.str.14 = [41 x i8] c"Buffer too small to hold decrypted data\0A\00"
@.str.15 = [22 x i8] c"Sucessfuly decrypted\0A\00"
@.str.16 = [45 x i8] c"Decrypted data does not match original data\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 i8*
%10 = alloca i8*
%11 = alloca [32 x i8]
%12 = alloca i64
%13 = alloca [4096 x i8]
%14 = alloca i64
%15 = alloca [4096 x i8]
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i32*
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %17
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 5
br i1 %23, label %24, label %33
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
store i8* %36, i8** %17
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
store i8* %39, i8** %19
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 3
%42 = load i8*, i8** %41
store i8* %42, i8** %9
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 4
%45 = load i8*, i8** %44
store i8* %45, i8** %10
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 5
%48 = load i8*, i8** %47
store i8* %48, i8** %18
%49 = load i8*, i8** %19
%50 = call i32 @CONF_modules_load_file(i8* %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0)
store i32 %50, i32* %21
%51 = load i32, i32* %21
%52 = icmp sle i32 %51, 0
br i1 %52, label %53, label %59
53: ; preds = %33
%54 = load i32, i32* @stderr
%55 = load i8*, i8** %19
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%57 = call i32 @display_openssl_errors(i32 94)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %33
%60 = call i32 (...) @ENGINE_add_conf_module()
%61 = call i32 (...) @OpenSSL_add_all_algorithms()
%62 = call i32 (...) @ERR_load_crypto_strings()
%63 = call i32 (...) @ERR_clear_error()
%64 = call i32 (...) @ENGINE_load_builtin_engines()
%65 = call i32* @ENGINE_by_id(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
store i32* %65, i32** %20
%66 = load i32*, i32** %20
%67 = icmp eq i32* %66, null
br i1 %67, label %68, label %71
68: ; preds = %59
%69 = call i32 @display_openssl_errors(i32 112)
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %59
%72 = load i32*, i32** %20
%73 = call i32 @ENGINE_ctrl_cmd_string(i32* %72, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* null, i32 0)
%74 = icmp ne i32 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %71
%76 = call i32 @display_openssl_errors(i32 117)
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %71
%79 = load i32*, i32** %20
%80 = load i8*, i8** %18
%81 = call i32 @ENGINE_ctrl_cmd_string(i32* %79, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %80, i32 0)
%82 = icmp ne i32 %81, 0
br i1 %82, label %86, label %83
83: ; preds = %78
%84 = call i32 @display_openssl_errors(i32 122)
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %78
%87 = load i32*, i32** %20
%88 = call i32 @ENGINE_init(i32* %87)
%89 = icmp ne i32 %88, 0
br i1 %89, label %93, label %90
90: ; preds = %86
%91 = call i32 @display_openssl_errors(i32 127)
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %86
%94 = load i8*, i8** %17
%95 = icmp ne i8* %94, null
br i1 %95, label %96, label %104
96: ; preds = %93
%97 = load i32*, i32** %20
%98 = load i8*, i8** %17
%99 = call i32 @ENGINE_ctrl_cmd_string(i32* %97, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %98, i32 0)
%100 = icmp ne i32 %99, 0
br i1 %100, label %104, label %101
101: ; preds = %96
%102 = call i32 @display_openssl_errors(i32 132)
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %96, %93
%105 = load i32*, i32** %20
%106 = load i8*, i8** %9
%107 = call i32* @ENGINE_load_private_key(i32* %105, i8* %106, i32* null, i32* null)
store i32* %107, i32** %6
%108 = load i32*, i32** %6
%109 = icmp eq i32* %108, null
br i1 %109, label %110, label %116
110: ; preds = %104
%111 = load i32, i32* @stderr
%112 = load i8*, i8** %9
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %111, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %112)
%114 = call i32 @display_openssl_errors(i32 139)
%115 = call i32 @exit(i32 1)
unreachable
116: ; preds = %104
%117 = load i32*, i32** %20
%118 = load i8*, i8** %10
%119 = call i32* @ENGINE_load_public_key(i32* %117, i8* %118, i32* null, i32* null)
store i32* %119, i32** %7
%120 = load i32*, i32** %7
%121 = icmp eq i32* %120, null
br i1 %121, label %122, label %128
122: ; preds = %116
%123 = load i32, i32* @stderr
%124 = load i8*, i8** %10
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %124)
%126 = call i32 @display_openssl_errors(i32 146)
%127 = call i32 @exit(i32 1)
unreachable
128: ; preds = %116
store i64 32, i64* %12
%129 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%130 = load i64, i64* %12
%131 = call i32 @RAND_bytes(i8* %129, i64 %130)
%132 = icmp ne i32 %131, 0
br i1 %132, label %136, label %133
133: ; preds = %128
%134 = call i32 @display_openssl_errors(i32 153)
%135 = call i32 @exit(i32 1)
unreachable
136: ; preds = %128
%137 = load i32*, i32** %7
%138 = load i32*, i32** %20
%139 = call i32* @EVP_PKEY_CTX_new(i32* %137, i32* %138)
store i32* %139, i32** %8
%140 = load i32*, i32** %8
%141 = icmp eq i32* %140, null
br i1 %141, label %142, label %147
142: ; preds = %136
%143 = load i32, i32* @stderr
%144 = call i32 (i32, i8*, ...) @fprintf(i32 %143, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%145 = call i32 @display_openssl_errors(i32 162)
%146 = call i32 @exit(i32 1)
unreachable
147: ; preds = %136
%148 = load i32*, i32** %8
%149 = call i64 @EVP_PKEY_encrypt_init(i32* %148)
%150 = icmp sle i64 %149, 0
br i1 %150, label %151, label %156
151: ; preds = %147
%152 = load i32, i32* @stderr
%153 = call i32 (i32, i8*, ...) @fprintf(i32 %152, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%154 = call i32 @display_openssl_errors(i32 168)
%155 = call i32 @exit(i32 1)
unreachable
156: ; preds = %147
%157 = load i32*, i32** %8
%158 = load i32, i32* @RSA_PKCS1_OAEP_PADDING
%159 = call i64 @EVP_PKEY_CTX_set_rsa_padding(i32* %157, i32 %158)
%160 = icmp sle i64 %159, 0
br i1 %160, label %161, label %166
161: ; preds = %156
%162 = load i32, i32* @stderr
%163 = call i32 (i32, i8*, ...) @fprintf(i32 %162, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%164 = call i32 @display_openssl_errors(i32 174)
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %156
store i64 4096, i64* %16
%167 = load i32*, i32** %8
%168 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%169 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%170 = load i64, i64* %12
%171 = call i64 @EVP_PKEY_encrypt(i32* %167, i8* %168, i64* %16, i8* %169, i64 %170)
%172 = icmp sle i64 %171, 0
br i1 %172, label %173, label %176
173: ; preds = %166
%174 = call i32 @display_openssl_errors(i32 180)
%175 = call i32 @exit(i32 1)
unreachable
176: ; preds = %166
%177 = load i32*, i32** %8
%178 = call i32 @EVP_PKEY_CTX_free(i32* %177)
%179 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
%180 = load i32*, i32** %6
%181 = load i32*, i32** %20
%182 = call i32* @EVP_PKEY_CTX_new(i32* %180, i32* %181)
store i32* %182, i32** %8
%183 = load i32*, i32** %8
%184 = icmp eq i32* %183, null
br i1 %184, label %185, label %190
185: ; preds = %176
%186 = load i32, i32* @stderr
%187 = call i32 (i32, i8*, ...) @fprintf(i32 %186, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%188 = call i32 @display_openssl_errors(i32 194)
%189 = call i32 @exit(i32 1)
unreachable
190: ; preds = %176
%191 = load i32*, i32** %8
%192 = call i64 @EVP_PKEY_decrypt_init(i32* %191)
%193 = icmp sle i64 %192, 0
br i1 %193, label %194, label %199
194: ; preds = %190
%195 = load i32, i32* @stderr
%196 = call i32 (i32, i8*, ...) @fprintf(i32 %195, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
%197 = call i32 @display_openssl_errors(i32 200)
%198 = call i32 @exit(i32 1)
unreachable
199: ; preds = %190
%200 = load i32*, i32** %8
%201 = load i32, i32* @RSA_PKCS1_OAEP_PADDING
%202 = call i64 @EVP_PKEY_CTX_set_rsa_padding(i32* %200, i32 %201)
%203 = icmp sle i64 %202, 0
br i1 %203, label %204, label %209
204: ; preds = %199
%205 = load i32, i32* @stderr
%206 = call i32 (i32, i8*, ...) @fprintf(i32 %205, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%207 = call i32 @display_openssl_errors(i32 206)
%208 = call i32 @exit(i32 1)
unreachable
209: ; preds = %199
%210 = load i32*, i32** %8
%211 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%212 = load i64, i64* %16
%213 = call i32 @EVP_PKEY_decrypt(i32* %210, i8* null, i64* %14, i8* %211, i64 %212)
store i32 %213, i32* %21
%214 = load i32, i32* %21
%215 = icmp slt i32 %214, 0
br i1 %215, label %216, label %219
216: ; preds = %209
%217 = call i32 @display_openssl_errors(i32 213)
%218 = call i32 @exit(i32 1)
unreachable
219: ; preds = %209
%220 = load i64, i64* %14
%221 = icmp ugt i64 %220, 4096
br i1 %221, label %222, label %226
222: ; preds = %219
%223 = load i32, i32* @stderr
%224 = call i32 (i32, i8*, ...) @fprintf(i32 %223, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0))
%225 = call i32 @exit(i32 1)
unreachable
226: ; preds = %219
%227 = load i32*, i32** %8
%228 = getelementptr inbounds [4096 x i8], [4096 x i8]* %13, i64 0, i64 0
%229 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%230 = load i64, i64* %16
%231 = call i32 @EVP_PKEY_decrypt(i32* %227, i8* %228, i64* %14, i8* %229, i64 %230)
store i32 %231, i32* %21
%232 = load i32, i32* %21
%233 = icmp slt i32 %232, 0
br i1 %233, label %234, label %237
234: ; preds = %226
%235 = call i32 @display_openssl_errors(i32 224)
%236 = call i32 @exit(i32 1)
unreachable
237: ; preds = %226
%238 = load i32*, i32** %8
%239 = call i32 @EVP_PKEY_CTX_free(i32* %238)
%240 = getelementptr inbounds [4096 x i8], [4096 x i8]* %13, i64 0, i64 0
%241 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%242 = load i64, i64* %12
%243 = call i32 @memcmp(i8* %240, i8* %241, i64 %242)
%244 = icmp ne i32 %243, 0
br i1 %244, label %247, label %245
245: ; preds = %237
%246 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0))
br label %251
247: ; preds = %237
%248 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.16, i64 0, i64 0))
%249 = call i32 @display_openssl_errors(i32 237)
%250 = call i32 @exit(i32 1)
unreachable
251: ; preds = %245
%252 = load i32*, i32** %20
%253 = call i32 @ENGINE_finish(i32* %252)
%254 = call i32 @CONF_modules_unload(i32 1)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [68 x i8] c"usage: %s [PIN] [CONF] [private key URL] [public key URL] [module]\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [8 x i8] c"engines\00"
@.str.3 = [16 x i8] c"cannot load %s\0A\00"
@.str.4 = [7 x i8] c"pkcs11\00"
@.str.5 = [8 x i8] c"VERBOSE\00"
@.str.6 = [12 x i8] c"MODULE_PATH\00"
@.str.7 = [4 x i8] c"PIN\00"
@.str.8 = [17 x i8] c"cannot load: %s\0A\00"
@.str.9 = [26 x i8] c"Could not create context\0A\00"
@.str.10 = [27 x i8] c"Could not init encryption\0A\00"
@RSA_PKCS1_OAEP_PADDING = global i32 0
@.str.11 = [23 x i8] c"Could not set padding\0A\00"
@.str.13 = [27 x i8] c"Could not init decryption\0A\00"
@.str.14 = [41 x i8] c"Buffer too small to hold decrypted data\0A\00"
@str = [15 x i8] c"Data encrypted\00"
@str.17 = [21 x i8] c"Sucessfuly decrypted\00"
@str.18 = [44 x i8] c"Decrypted data does not match original data\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = alloca [4096 x i8]
%5 = alloca i64
%6 = alloca [4096 x i8]
%7 = alloca i64
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%10 = bitcast i64* %5 to i8*
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%12 = bitcast i64* %7 to i8*
%13 = icmp slt i32 %0, 5
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8*, i8** %1, i64 4
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8*, i8** %1, i64 5
%31 = load i8*, i8** %30
%32 = tail call i32 @CONF_modules_load_file(i8* %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0)
%33 = icmp slt i32 %32, 1
br i1 %33, label %34, label %39
34: ; preds = %21
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%37 = tail call i32 @display_openssl_errors(i32 94)
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %21
%40 = tail call i32 (...) @ENGINE_add_conf_module()
%41 = tail call i32 (...) @OpenSSL_add_all_algorithms()
%42 = tail call i32 (...) @ERR_load_crypto_strings()
%43 = tail call i32 (...) @ERR_clear_error()
%44 = tail call i32 (...) @ENGINE_load_builtin_engines()
%45 = tail call i32* @ENGINE_by_id(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %50
47: ; preds = %39
%48 = tail call i32 @display_openssl_errors(i32 112)
%49 = tail call i32 @exit(i32 1)
unreachable
50: ; preds = %39
%51 = tail call i32 @ENGINE_ctrl_cmd_string(i32* %45, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* null, i32 0)
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = tail call i32 @display_openssl_errors(i32 117)
%55 = tail call i32 @exit(i32 1)
unreachable
56: ; preds = %50
%57 = tail call i32 @ENGINE_ctrl_cmd_string(i32* %45, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %31, i32 0)
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = tail call i32 @display_openssl_errors(i32 122)
%61 = tail call i32 @exit(i32 1)
unreachable
62: ; preds = %56
%63 = tail call i32 @ENGINE_init(i32* %45)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = tail call i32 @display_openssl_errors(i32 127)
%67 = tail call i32 @exit(i32 1)
unreachable
68: ; preds = %62
%69 = icmp eq i8* %23, null
br i1 %69, label %76, label %70
70: ; preds = %68
%71 = tail call i32 @ENGINE_ctrl_cmd_string(i32* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %23, i32 0)
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = tail call i32 @display_openssl_errors(i32 132)
%75 = tail call i32 @exit(i32 1)
unreachable
76: ; preds = %70, %68
%77 = tail call i32* @ENGINE_load_private_key(i32* %45, i8* %27, i32* null, i32* null)
%78 = icmp eq i32* %77, null
br i1 %78, label %79, label %84
79: ; preds = %76
%80 = load i32, i32* @stderr
%81 = tail call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %27)
%82 = tail call i32 @display_openssl_errors(i32 139)
%83 = tail call i32 @exit(i32 1)
unreachable
84: ; preds = %76
%85 = tail call i32* @ENGINE_load_public_key(i32* %45, i8* %29, i32* null, i32* null)
%86 = icmp eq i32* %85, null
br i1 %86, label %87, label %92
87: ; preds = %84
%88 = load i32, i32* @stderr
%89 = tail call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %29)
%90 = tail call i32 @display_openssl_errors(i32 146)
%91 = tail call i32 @exit(i32 1)
unreachable
92: ; preds = %84
%93 = call i32 @RAND_bytes(i8* %8, i64 32)
%94 = icmp eq i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %92
%96 = call i32 @display_openssl_errors(i32 153)
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %92
%99 = call i32* @EVP_PKEY_CTX_new(i32* %85, i32* %45)
%100 = icmp eq i32* %99, null
br i1 %100, label %101, label %106
101: ; preds = %98
%102 = load i32, i32* @stderr
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %102, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%104 = call i32 @display_openssl_errors(i32 162)
%105 = call i32 @exit(i32 1)
unreachable
106: ; preds = %98
%107 = call i64 @EVP_PKEY_encrypt_init(i32* %99)
%108 = icmp slt i64 %107, 1
br i1 %108, label %109, label %114
109: ; preds = %106
%110 = load i32, i32* @stderr
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%112 = call i32 @display_openssl_errors(i32 168)
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %106
%115 = load i32, i32* @RSA_PKCS1_OAEP_PADDING
%116 = call i64 @EVP_PKEY_CTX_set_rsa_padding(i32* %99, i32 %115)
%117 = icmp slt i64 %116, 1
br i1 %117, label %118, label %123
118: ; preds = %114
%119 = load i32, i32* @stderr
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%121 = call i32 @display_openssl_errors(i32 174)
%122 = call i32 @exit(i32 1)
unreachable
123: ; preds = %114
store i64 4096, i64* %7
%124 = call i64 @EVP_PKEY_encrypt(i32* %99, i8* %11, i64* %7, i8* %8, i64 32)
%125 = icmp slt i64 %124, 1
br i1 %125, label %126, label %129
126: ; preds = %123
%127 = call i32 @display_openssl_errors(i32 180)
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %123
%130 = call i32 @EVP_PKEY_CTX_free(i32* %99)
%131 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%132 = call i32* @EVP_PKEY_CTX_new(i32* %77, i32* %45)
%133 = icmp eq i32* %132, null
br i1 %133, label %134, label %139
134: ; preds = %129
%135 = load i32, i32* @stderr
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%137 = call i32 @display_openssl_errors(i32 194)
%138 = call i32 @exit(i32 1)
unreachable
139: ; preds = %129
%140 = call i64 @EVP_PKEY_decrypt_init(i32* %132)
%141 = icmp slt i64 %140, 1
br i1 %141, label %142, label %147
142: ; preds = %139
%143 = load i32, i32* @stderr
%144 = call i32 (i32, i8*, ...) @fprintf(i32 %143, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
%145 = call i32 @display_openssl_errors(i32 200)
%146 = call i32 @exit(i32 1)
unreachable
147: ; preds = %139
%148 = load i32, i32* @RSA_PKCS1_OAEP_PADDING
%149 = call i64 @EVP_PKEY_CTX_set_rsa_padding(i32* %132, i32 %148)
%150 = icmp slt i64 %149, 1
br i1 %150, label %151, label %156
151: ; preds = %147
%152 = load i32, i32* @stderr
%153 = call i32 (i32, i8*, ...) @fprintf(i32 %152, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%154 = call i32 @display_openssl_errors(i32 206)
%155 = call i32 @exit(i32 1)
unreachable
156: ; preds = %147
%157 = load i64, i64* %7
%158 = call i32 @EVP_PKEY_decrypt(i32* %132, i8* null, i64* %5, i8* %11, i64 %157)
%159 = icmp slt i32 %158, 0
br i1 %159, label %160, label %163
160: ; preds = %156
%161 = call i32 @display_openssl_errors(i32 213)
%162 = call i32 @exit(i32 1)
unreachable
163: ; preds = %156
%164 = load i64, i64* %5
%165 = icmp ugt i64 %164, 4096
br i1 %165, label %166, label %170
166: ; preds = %163
%167 = load i32, i32* @stderr
%168 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0))
%169 = call i32 @exit(i32 1)
unreachable
170: ; preds = %163
%171 = load i64, i64* %7
%172 = call i32 @EVP_PKEY_decrypt(i32* %132, i8* %9, i64* %5, i8* %11, i64 %171)
%173 = icmp slt i32 %172, 0
br i1 %173, label %174, label %177
174: ; preds = %170
%175 = call i32 @display_openssl_errors(i32 224)
%176 = call i32 @exit(i32 1)
unreachable
177: ; preds = %170
%178 = call i32 @EVP_PKEY_CTX_free(i32* %132)
%179 = call i32 @bcmp(i8* dereferenceable(32) %9, i8* dereferenceable(32) %8, i64 32)
%180 = icmp eq i32 %179, 0
br i1 %180, label %181, label %185
181: ; preds = %177
%182 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.17, i64 0, i64 0))
%183 = call i32 @ENGINE_finish(i32* %45)
%184 = call i32 @CONF_modules_unload(i32 1)
ret i32 0
185: ; preds = %177
%186 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.18, i64 0, i64 0))
%187 = call i32 @display_openssl_errors(i32 237)
%188 = call i32 @exit(i32 1)
unreachable
}