#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*/ sig;
typedef int /*<<< orphan*/ md;
typedef int /*<<< orphan*/ EVP_PKEY_CTX;
typedef int /*<<< orphan*/ EVP_PKEY;
typedef int /*<<< orphan*/ EVP_MD_CTX;
typedef int /*<<< orphan*/ EVP_MD;
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();
scalar_t__ EVP_DigestFinal(int /*<<< orphan*/ *, unsigned char *,
                           unsigned int *);
scalar_t__ EVP_DigestInit(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
scalar_t__ EVP_DigestUpdate(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ *EVP_MD_CTX_create();
int /*<<< orphan*/ EVP_MD_CTX_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_MD_size(int /*<<< orphan*/ const *);
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*/);
scalar_t__ EVP_PKEY_CTX_set_signature_md(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/ const *);
scalar_t__ EVP_PKEY_sign(int /*<<< orphan*/ *, unsigned char *, size_t *,
                         unsigned char *, int /*<<< orphan*/);
scalar_t__ EVP_PKEY_sign_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_get_digestbyname(char *);
char *OPENSSL_VERSION_TEXT;
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
int /*<<< orphan*/ OpenSSL_add_all_digests();
int /*<<< orphan*/ RSA_PKCS1_PSS_PADDING;
int /*<<< orphan*/ display_openssl_errors(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  EVP_PKEY *private_key, *public_key;
  EVP_PKEY_CTX *pkey_ctx;
  EVP_MD_CTX *md_ctx;
  const EVP_MD *digest_algo;
  char *private_key_name, *public_key_name;
  unsigned char sig[4096];
  size_t sig_len;
  unsigned char md[128];
  size_t md_len;
  unsigned digest_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();
  OpenSSL_add_all_digests();
  ERR_load_crypto_strings();
  ERR_clear_error();
  ENGINE_load_builtin_engines();
  e = ENGINE_by_id("pkcs11");
  if (e == NULL) {
    display_openssl_errors(113);
    exit(1);
  }
  if (!ENGINE_ctrl_cmd_string(e, "VERBOSE", NULL, 0)) {
    display_openssl_errors(118);
    exit(1);
  }
  if (!ENGINE_ctrl_cmd_string(e, "MODULE_PATH", module_path, 0)) {
    display_openssl_errors(123);
    exit(1);
  }
  if (!ENGINE_init(e)) {
    display_openssl_errors(128);
    exit(1);
  }
  if (key_pass && !ENGINE_ctrl_cmd_string(e, "PIN", key_pass, 0)) {
    display_openssl_errors(133);
    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(140);
    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(147);
    exit(1);
  }
  digest_algo = EVP_get_digestbyname("sha256");
  md_ctx = EVP_MD_CTX_create();
  if (EVP_DigestInit(md_ctx, digest_algo) <= 0) {
    display_openssl_errors(157);
    exit(1);
  }
  if (EVP_DigestUpdate(md_ctx, "test data", sizeof("test data")) <= 0) {
    display_openssl_errors(162);
    exit(1);
  }
  digest_len = sizeof(md);
  if (EVP_DigestFinal(md_ctx, md, &digest_len) <= 0) {
    display_openssl_errors(168);
    exit(1);
  }
  md_len = digest_len;
  EVP_MD_CTX_destroy(md_ctx);
  pkey_ctx = EVP_PKEY_CTX_new(private_key, e);
  if (pkey_ctx == NULL) {
    fprintf(stderr, "Could not create context\n");
    display_openssl_errors(180);
    exit(1);
  }
  if (EVP_PKEY_sign_init(pkey_ctx) <= 0) {
    fprintf(stderr, "Could not init signature\n");
    display_openssl_errors(186);
    exit(1);
  }
  if (EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, RSA_PKCS1_PSS_PADDING) <= 0) {
    fprintf(stderr, "Could not set padding\n");
    display_openssl_errors(192);
    exit(1);
  }
  if (EVP_PKEY_CTX_set_signature_md(pkey_ctx, digest_algo) <= 0) {
    fprintf(stderr, "Could not set message digest algorithm\n");
    display_openssl_errors(198);
    exit(1);
  }
  sig_len = sizeof(sig);
  if (EVP_PKEY_sign(pkey_ctx, sig, &sig_len, md, EVP_MD_size(digest_algo)) <=
      0) {
    display_openssl_errors(205);
    exit(1);
  }
  EVP_PKEY_CTX_free(pkey_ctx);
  printf("Signature created\n");
  printf("Unable to verify signature with %s\n", OPENSSL_VERSION_TEXT);
  ENGINE_finish(e);
  CONF_modules_unload(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x10f8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    135d <main+0x6d>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xccb(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
lea    0xcf6(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x10f8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x1108(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x1100(%rbp)
mov    -0x1108(%rbp),%rdi
lea    0xc94(%rip),%rsi
xor    %edx,%edx
call   1040 <CONF_modules_load_file@plt>
mov    %eax,-0x1114(%rbp)
cmpl   $0x0,-0x1114(%rbp)
jg     13fc <main+0x10c>
mov    0x2c07(%rip),%rax
mov    (%rax),%edi
mov    -0x1108(%rbp),%rdx
lea    0xc6b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x5e,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    $0x0,%al
call   1170 <ENGINE_add_conf_module@plt>
mov    $0x0,%al
call   10e0 <OpenSSL_add_all_algorithms@plt>
mov    $0x0,%al
call   10c0 <OpenSSL_add_all_digests@plt>
mov    $0x0,%al
call   11a0 <ERR_load_crypto_strings@plt>
mov    $0x0,%al
call   10f0 <ERR_clear_error@plt>
mov    $0x0,%al
call   11c0 <ENGINE_load_builtin_engines@plt>
lea    0xc2f(%rip),%rdi
call   1210 <ENGINE_by_id@plt>
mov    %rax,-0x1110(%rbp)
cmpq   $0x0,-0x1110(%rbp)
jne    145b <main+0x16b>
mov    $0x71,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x1110(%rbp),%rdi
lea    0xbfa(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <ENGINE_ctrl_cmd_string@plt>
cmp    $0x0,%eax
jne    1491 <main+0x1a1>
mov    $0x76,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x1110(%rbp),%rdi
mov    -0x1100(%rbp),%rdx
lea    0xbc5(%rip),%rsi
xor    %ecx,%ecx
call   1080 <ENGINE_ctrl_cmd_string@plt>
cmp    $0x0,%eax
jne    14ca <main+0x1da>
mov    $0x7b,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x1110(%rbp),%rdi
call   1070 <ENGINE_init@plt>
cmp    $0x0,%eax
jne    14f3 <main+0x203>
mov    $0x80,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
cmpq   $0x0,-0x10f8(%rbp)
je     153a <main+0x24a>
mov    -0x1110(%rbp),%rdi
mov    -0x10f8(%rbp),%rdx
lea    0xb61(%rip),%rsi
xor    %ecx,%ecx
call   1080 <ENGINE_ctrl_cmd_string@plt>
cmp    $0x0,%eax
jne    153a <main+0x24a>
mov    $0x85,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x1110(%rbp),%rdi
mov    -0x40(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   11e0 <ENGINE_load_private_key@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    158f <main+0x29f>
mov    0x2a71(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    0xb07(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x8c,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x1110(%rbp),%rdi
mov    -0x48(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   11d0 <ENGINE_load_public_key@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    15e4 <main+0x2f4>
mov    0x2a1c(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
lea    0xab2(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x93,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
lea    0xaa1(%rip),%rdi
call   1120 <EVP_get_digestbyname@plt>
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1200 <EVP_MD_CTX_create@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10a0 <EVP_DigestInit@plt>
cmp    $0x0,%rax
jg     162a <main+0x33a>
mov    $0x9d,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x30(%rbp),%rdi
lea    0xa5e(%rip),%rsi
mov    $0xa,%edx
call   1100 <EVP_DigestUpdate@plt>
cmp    $0x0,%rax
jg     165d <main+0x36d>
mov    $0xa2,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
movl   $0x80,-0x10ec(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x10e0(%rbp),%rsi
lea    -0x10ec(%rbp),%rdx
call   1150 <EVP_DigestFinal@plt>
cmp    $0x0,%rax
jg     169c <main+0x3ac>
mov    $0xa8,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x10ec(%rbp),%eax
mov    %rax,-0x10e8(%rbp)
mov    -0x30(%rbp),%rdi
call   1110 <EVP_MD_CTX_destroy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1110(%rbp),%rsi
call   1030 <EVP_PKEY_CTX_new@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    16fc <main+0x40c>
mov    0x2900(%rip),%rax
mov    (%rax),%edi
lea    0x9bc(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xb4,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x28(%rbp),%rdi
call   1130 <EVP_PKEY_sign_init@plt>
cmp    $0x0,%rax
jg     173a <main+0x44a>
mov    0x28c2(%rip),%rax
mov    (%rax),%edi
lea    0x998(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xba,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    0x2883(%rip),%rax
mov    (%rax),%esi
call   1190 <EVP_PKEY_CTX_set_rsa_padding@plt>
cmp    $0x0,%rax
jg     1781 <main+0x491>
mov    0x287b(%rip),%rax
mov    (%rax),%edi
lea    0x96b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xc0,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <EVP_PKEY_CTX_set_signature_md@plt>
cmp    $0x0,%rax
jg     17c3 <main+0x4d3>
mov    0x2839(%rip),%rax
mov    (%rax),%edi
lea    0x940(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xc6,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
movq   $0x1000,-0x1058(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x1130(%rbp)
lea    -0x1050(%rbp),%rax
mov    %rax,-0x1128(%rbp)
lea    -0x10e0(%rbp),%rax
mov    %rax,-0x1120(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <EVP_MD_size@plt>
mov    -0x1130(%rbp),%rdi
mov    -0x1128(%rbp),%rsi
mov    -0x1120(%rbp),%rcx
mov    %eax,%r8d
lea    -0x1058(%rbp),%rdx
call   1140 <EVP_PKEY_sign@plt>
cmp    $0x0,%rax
jg     1840 <main+0x550>
mov    $0xcd,%edi
call   1180 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x28(%rbp),%rdi
call   11f0 <EVP_PKEY_CTX_free@plt>
lea    0x8c0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x278a(%rip),%rax
mov    (%rax),%rsi
lea    0x8bb(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x1110(%rbp),%rdi
call   1160 <ENGINE_finish@plt>
mov    $0x1,%edi
call   10b0 <CONF_modules_unload@plt>
xor    %eax,%eax
add    $0x1130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1098,%rsp
cmp    $0x4,%edi
jle    1578 <main+0x278>
mov    0x8(%rsi),%r12
mov    0x10(%rsi),%rbx
mov    0x18(%rsi),%r15
mov    0x20(%rsi),%r14
mov    0x28(%rsi),%r13
lea    0xd0f(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1040 <CONF_modules_load_file@plt>
test   %eax,%eax
jle    15ac <main+0x2ac>
xor    %eax,%eax
call   1180 <ENGINE_add_conf_module@plt>
xor    %eax,%eax
call   10f0 <OpenSSL_add_all_algorithms@plt>
xor    %eax,%eax
call   10d0 <OpenSSL_add_all_digests@plt>
xor    %eax,%eax
call   11b0 <ERR_load_crypto_strings@plt>
xor    %eax,%eax
call   1100 <ERR_clear_error@plt>
xor    %eax,%eax
call   11d0 <ENGINE_load_builtin_engines@plt>
lea    0xce4(%rip),%rdi
call   1220 <ENGINE_by_id@plt>
test   %rax,%rax
je     15d0 <main+0x2d0>
mov    %rax,%rbp
lea    0xcd3(%rip),%rsi
mov    %rax,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <ENGINE_ctrl_cmd_string@plt>
test   %eax,%eax
je     15da <main+0x2da>
lea    0xcc0(%rip),%rsi
mov    %rbp,%rdi
mov    %r13,%rdx
xor    %ecx,%ecx
call   1090 <ENGINE_ctrl_cmd_string@plt>
test   %eax,%eax
je     15e4 <main+0x2e4>
mov    %rbp,%rdi
call   1080 <ENGINE_init@plt>
test   %eax,%eax
je     15ee <main+0x2ee>
test   %r12,%r12
je     13f1 <main+0xf1>
lea    0xc9b(%rip),%rsi
mov    %rbp,%rdi
mov    %r12,%rdx
xor    %ecx,%ecx
call   1090 <ENGINE_ctrl_cmd_string@plt>
test   %eax,%eax
je     16dd <main+0x3dd>
mov    %rbp,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   11f0 <ENGINE_load_private_key@plt>
test   %rax,%rax
je     15f8 <main+0x2f8>
mov    %rax,%r12
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   11e0 <ENGINE_load_public_key@plt>
test   %rax,%rax
je     161c <main+0x31c>
lea    0xc61(%rip),%rdi
call   1130 <EVP_get_digestbyname@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1210 <EVP_MD_CTX_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   10b0 <EVP_DigestInit@plt>
test   %rax,%rax
jle    1640 <main+0x340>
lea    0xc3b(%rip),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1110 <EVP_DigestUpdate@plt>
test   %rax,%rax
jle    164a <main+0x34a>
movl   $0x80,0x4(%rsp)
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
call   1160 <EVP_DigestFinal@plt>
test   %rax,%rax
jle    1654 <main+0x354>
mov    %rbx,%rdi
call   1120 <EVP_MD_CTX_destroy@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1030 <EVP_PKEY_CTX_new@plt>
test   %rax,%rax
je     165e <main+0x35e>
mov    %rax,%rbx
mov    %rax,%rdi
call   1140 <EVP_PKEY_sign_init@plt>
test   %rax,%rax
jle    167c <main+0x37c>
mov    0x2b00(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   11a0 <EVP_PKEY_CTX_set_rsa_padding@plt>
test   %rax,%rax
jle    169a <main+0x39a>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <EVP_PKEY_CTX_set_signature_md@plt>
test   %rax,%rax
jle    16b8 <main+0x3b8>
movq   $0x1000,0x8(%rsp)
mov    %r14,%rdi
call   1050 <EVP_MD_size@plt>
lea    0x90(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rbx,%rdi
mov    %eax,%r8d
call   1150 <EVP_PKEY_sign@plt>
test   %rax,%rax
jle    16d6 <main+0x3d6>
mov    %rbx,%rdi
call   1200 <EVP_PKEY_CTX_free@plt>
lea    0xbff(%rip),%rdi
call   1060 <puts@plt>
mov    0x2aa7(%rip),%rax
mov    (%rax),%rsi
lea    0xbc5(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbp,%rdi
call   1170 <ENGINE_finish@plt>
mov    $0x1,%edi
call   10c0 <CONF_modules_unload@plt>
xor    %eax,%eax
add    $0x1098,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a59(%rip),%rbx
mov    (%rbx),%edi
mov    (%rsi),%rdx
lea    0xa75(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xaa7(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   11c0 <exit@plt>
mov    0x2a25(%rip),%rax
mov    (%rax),%edi
lea    0xa90(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x5e,%edi
jmp    16e2 <main+0x3e2>
mov    $0x71,%edi
jmp    16e2 <main+0x3e2>
mov    $0x76,%edi
jmp    16e2 <main+0x3e2>
mov    $0x7b,%edi
jmp    16e2 <main+0x3e2>
mov    $0x80,%edi
jmp    16e2 <main+0x3e2>
mov    0x29d9(%rip),%rax
mov    (%rax),%edi
lea    0xa73(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x8c,%edi
jmp    16e2 <main+0x3e2>
mov    0x29b5(%rip),%rax
mov    (%rax),%edi
lea    0xa4f(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x93,%edi
jmp    16e2 <main+0x3e2>
mov    $0x9d,%edi
jmp    16e2 <main+0x3e2>
mov    $0xa2,%edi
jmp    16e2 <main+0x3e2>
mov    $0xa8,%edi
jmp    16e2 <main+0x3e2>
mov    0x2973(%rip),%rax
mov    (%rax),%edi
lea    0xa2f(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0xb4,%edi
jmp    16e2 <main+0x3e2>
mov    0x2955(%rip),%rax
mov    (%rax),%edi
lea    0xa2b(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0xba,%edi
jmp    16e2 <main+0x3e2>
mov    0x2937(%rip),%rax
mov    (%rax),%edi
lea    0xa27(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0xc0,%edi
jmp    16e2 <main+0x3e2>
mov    0x2919(%rip),%rax
mov    (%rax),%edi
lea    0xa20(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0xc6,%edi
jmp    16e2 <main+0x3e2>
mov    $0xcd,%edi
jmp    16e2 <main+0x3e2>
mov    $0x85,%edi
call   1190 <display_openssl_errors@plt>
mov    $0x1,%edi
call   11c0 <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 = [7 x i8] c"sha256\00"
@.str.10 = [10 x i8] c"test data\00"
@.str.11 = [26 x i8] c"Could not create context\0A\00"
@.str.12 = [26 x i8] c"Could not init signature\0A\00"
@RSA_PKCS1_PSS_PADDING = global i32 0
@.str.13 = [23 x i8] c"Could not set padding\0A\00"
@.str.14 = [40 x i8] c"Could not set message digest algorithm\0A\00"
@.str.15 = [19 x i8] c"Signature created\0A\00"
@.str.16 = [36 x i8] c"Unable to verify signature with %s\0A\00"
@OPENSSL_VERSION_TEXT = global i8* null
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 i32*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca [4096 x i8]
%14 = alloca i64
%15 = alloca [128 x i8]
%16 = alloca i64
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32*
%22 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %18
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 5
br i1 %24, label %25, label %34
25: ; preds = %2
%26 = load i32, i32* @stderr
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %29)
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %2
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
store i8* %37, i8** %18
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
store i8* %40, i8** %20
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 3
%43 = load i8*, i8** %42
store i8* %43, i8** %11
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 4
%46 = load i8*, i8** %45
store i8* %46, i8** %12
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 5
%49 = load i8*, i8** %48
store i8* %49, i8** %19
%50 = load i8*, i8** %20
%51 = call i32 @CONF_modules_load_file(i8* %50, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0)
store i32 %51, i32* %22
%52 = load i32, i32* %22
%53 = icmp sle i32 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %34
%55 = load i32, i32* @stderr
%56 = load i8*, i8** %20
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = call i32 @display_openssl_errors(i32 94)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %34
%61 = call i32 (...) @ENGINE_add_conf_module()
%62 = call i32 (...) @OpenSSL_add_all_algorithms()
%63 = call i32 (...) @OpenSSL_add_all_digests()
%64 = call i32 (...) @ERR_load_crypto_strings()
%65 = call i32 (...) @ERR_clear_error()
%66 = call i32 (...) @ENGINE_load_builtin_engines()
%67 = call i32* @ENGINE_by_id(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
store i32* %67, i32** %21
%68 = load i32*, i32** %21
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %73
70: ; preds = %60
%71 = call i32 @display_openssl_errors(i32 113)
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %60
%74 = load i32*, i32** %21
%75 = call i32 @ENGINE_ctrl_cmd_string(i32* %74, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* null, i32 0)
%76 = icmp ne i32 %75, 0
br i1 %76, label %80, label %77
77: ; preds = %73
%78 = call i32 @display_openssl_errors(i32 118)
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %73
%81 = load i32*, i32** %21
%82 = load i8*, i8** %19
%83 = call i32 @ENGINE_ctrl_cmd_string(i32* %81, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %82, i32 0)
%84 = icmp ne i32 %83, 0
br i1 %84, label %88, label %85
85: ; preds = %80
%86 = call i32 @display_openssl_errors(i32 123)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %80
%89 = load i32*, i32** %21
%90 = call i32 @ENGINE_init(i32* %89)
%91 = icmp ne i32 %90, 0
br i1 %91, label %95, label %92
92: ; preds = %88
%93 = call i32 @display_openssl_errors(i32 128)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %88
%96 = load i8*, i8** %18
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %106
98: ; preds = %95
%99 = load i32*, i32** %21
%100 = load i8*, i8** %18
%101 = call i32 @ENGINE_ctrl_cmd_string(i32* %99, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %100, i32 0)
%102 = icmp ne i32 %101, 0
br i1 %102, label %106, label %103
103: ; preds = %98
%104 = call i32 @display_openssl_errors(i32 133)
%105 = call i32 @exit(i32 1)
unreachable
106: ; preds = %98, %95
%107 = load i32*, i32** %21
%108 = load i8*, i8** %11
%109 = call i32* @ENGINE_load_private_key(i32* %107, i8* %108, i32* null, i32* null)
store i32* %109, i32** %6
%110 = load i32*, i32** %6
%111 = icmp eq i32* %110, null
br i1 %111, label %112, label %118
112: ; preds = %106
%113 = load i32, i32* @stderr
%114 = load i8*, i8** %11
%115 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %114)
%116 = call i32 @display_openssl_errors(i32 140)
%117 = call i32 @exit(i32 1)
unreachable
118: ; preds = %106
%119 = load i32*, i32** %21
%120 = load i8*, i8** %12
%121 = call i32* @ENGINE_load_public_key(i32* %119, i8* %120, i32* null, i32* null)
store i32* %121, i32** %7
%122 = load i32*, i32** %7
%123 = icmp eq i32* %122, null
br i1 %123, label %124, label %130
124: ; preds = %118
%125 = load i32, i32* @stderr
%126 = load i8*, i8** %12
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %126)
%128 = call i32 @display_openssl_errors(i32 147)
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %118
%131 = call i32* @EVP_get_digestbyname(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
store i32* %131, i32** %10
%132 = call i32* (...) @EVP_MD_CTX_create()
store i32* %132, i32** %9
%133 = load i32*, i32** %9
%134 = load i32*, i32** %10
%135 = call i64 @EVP_DigestInit(i32* %133, i32* %134)
%136 = icmp sle i64 %135, 0
br i1 %136, label %137, label %140
137: ; preds = %130
%138 = call i32 @display_openssl_errors(i32 157)
%139 = call i32 @exit(i32 1)
unreachable
140: ; preds = %130
%141 = load i32*, i32** %9
%142 = call i64 @EVP_DigestUpdate(i32* %141, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 10)
%143 = icmp sle i64 %142, 0
br i1 %143, label %144, label %147
144: ; preds = %140
%145 = call i32 @display_openssl_errors(i32 162)
%146 = call i32 @exit(i32 1)
unreachable
147: ; preds = %140
store i32 128, i32* %17
%148 = load i32*, i32** %9
%149 = getelementptr inbounds [128 x i8], [128 x i8]* %15, i64 0, i64 0
%150 = call i64 @EVP_DigestFinal(i32* %148, i8* %149, i32* %17)
%151 = icmp sle i64 %150, 0
br i1 %151, label %152, label %155
152: ; preds = %147
%153 = call i32 @display_openssl_errors(i32 168)
%154 = call i32 @exit(i32 1)
unreachable
155: ; preds = %147
%156 = load i32, i32* %17
%157 = zext i32 %156 to i64
store i64 %157, i64* %16
%158 = load i32*, i32** %9
%159 = call i32 @EVP_MD_CTX_destroy(i32* %158)
%160 = load i32*, i32** %6
%161 = load i32*, i32** %21
%162 = call i32* @EVP_PKEY_CTX_new(i32* %160, i32* %161)
store i32* %162, i32** %8
%163 = load i32*, i32** %8
%164 = icmp eq i32* %163, null
br i1 %164, label %165, label %170
165: ; preds = %155
%166 = load i32, i32* @stderr
%167 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
%168 = call i32 @display_openssl_errors(i32 180)
%169 = call i32 @exit(i32 1)
unreachable
170: ; preds = %155
%171 = load i32*, i32** %8
%172 = call i64 @EVP_PKEY_sign_init(i32* %171)
%173 = icmp sle i64 %172, 0
br i1 %173, label %174, label %179
174: ; preds = %170
%175 = load i32, i32* @stderr
%176 = call i32 (i32, i8*, ...) @fprintf(i32 %175, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
%177 = call i32 @display_openssl_errors(i32 186)
%178 = call i32 @exit(i32 1)
unreachable
179: ; preds = %170
%180 = load i32*, i32** %8
%181 = load i32, i32* @RSA_PKCS1_PSS_PADDING
%182 = call i64 @EVP_PKEY_CTX_set_rsa_padding(i32* %180, i32 %181)
%183 = icmp sle i64 %182, 0
br i1 %183, label %184, label %189
184: ; preds = %179
%185 = load i32, i32* @stderr
%186 = call i32 (i32, i8*, ...) @fprintf(i32 %185, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
%187 = call i32 @display_openssl_errors(i32 192)
%188 = call i32 @exit(i32 1)
unreachable
189: ; preds = %179
%190 = load i32*, i32** %8
%191 = load i32*, i32** %10
%192 = call i64 @EVP_PKEY_CTX_set_signature_md(i32* %190, i32* %191)
%193 = icmp sle i64 %192, 0
br i1 %193, label %194, label %199
194: ; preds = %189
%195 = load i32, i32* @stderr
%196 = call i32 (i32, i8*, ...) @fprintf(i32 %195, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.14, i64 0, i64 0))
%197 = call i32 @display_openssl_errors(i32 198)
%198 = call i32 @exit(i32 1)
unreachable
199: ; preds = %189
store i64 4096, i64* %14
%200 = load i32*, i32** %8
%201 = getelementptr inbounds [4096 x i8], [4096 x i8]* %13, i64 0, i64 0
%202 = getelementptr inbounds [128 x i8], [128 x i8]* %15, i64 0, i64 0
%203 = load i32*, i32** %10
%204 = call i32 @EVP_MD_size(i32* %203)
%205 = call i64 @EVP_PKEY_sign(i32* %200, i8* %201, i64* %14, i8* %202, i32 %204)
%206 = icmp sle i64 %205, 0
br i1 %206, label %207, label %210
207: ; preds = %199
%208 = call i32 @display_openssl_errors(i32 205)
%209 = call i32 @exit(i32 1)
unreachable
210: ; preds = %199
%211 = load i32*, i32** %8
%212 = call i32 @EVP_PKEY_CTX_free(i32* %211)
%213 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0))
%214 = load i8*, i8** @OPENSSL_VERSION_TEXT
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0), i8* %214)
%216 = load i32*, i32** %21
%217 = call i32 @ENGINE_finish(i32* %216)
%218 = 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 = [7 x i8] c"sha256\00"
@.str.10 = [10 x i8] c"test data\00"
@.str.11 = [26 x i8] c"Could not create context\0A\00"
@.str.12 = [26 x i8] c"Could not init signature\0A\00"
@RSA_PKCS1_PSS_PADDING = global i32 0
@.str.13 = [23 x i8] c"Could not set padding\0A\00"
@.str.14 = [40 x i8] c"Could not set message digest algorithm\0A\00"
@.str.16 = [36 x i8] c"Unable to verify signature with %s\0A\00"
@OPENSSL_VERSION_TEXT = global i8* null
@str = [18 x i8] c"Signature created\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca i64
%5 = alloca [128 x i8]
%6 = alloca i32
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%8 = bitcast i64* %4 to i8*
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%10 = bitcast i32* %6 to i8*
%11 = icmp slt i32 %0, 5
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 4
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8*, i8** %1, i64 5
%29 = load i8*, i8** %28
%30 = tail call i32 @CONF_modules_load_file(i8* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0)
%31 = icmp slt i32 %30, 1
br i1 %31, label %32, label %37
32: ; preds = %19
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%35 = tail call i32 @display_openssl_errors(i32 94)
%36 = tail call i32 @exit(i32 1)
unreachable
37: ; preds = %19
%38 = tail call i32 (...) @ENGINE_add_conf_module()
%39 = tail call i32 (...) @OpenSSL_add_all_algorithms()
%40 = tail call i32 (...) @OpenSSL_add_all_digests()
%41 = tail call i32 (...) @ERR_load_crypto_strings()
%42 = tail call i32 (...) @ERR_clear_error()
%43 = tail call i32 (...) @ENGINE_load_builtin_engines()
%44 = tail call i32* @ENGINE_by_id(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %49
46: ; preds = %37
%47 = tail call i32 @display_openssl_errors(i32 113)
%48 = tail call i32 @exit(i32 1)
unreachable
49: ; preds = %37
%50 = tail call i32 @ENGINE_ctrl_cmd_string(i32* %44, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* null, i32 0)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = tail call i32 @display_openssl_errors(i32 118)
%54 = tail call i32 @exit(i32 1)
unreachable
55: ; preds = %49
%56 = tail call i32 @ENGINE_ctrl_cmd_string(i32* %44, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %29, i32 0)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = tail call i32 @display_openssl_errors(i32 123)
%60 = tail call i32 @exit(i32 1)
unreachable
61: ; preds = %55
%62 = tail call i32 @ENGINE_init(i32* %44)
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = tail call i32 @display_openssl_errors(i32 128)
%66 = tail call i32 @exit(i32 1)
unreachable
67: ; preds = %61
%68 = icmp eq i8* %21, null
br i1 %68, label %75, label %69
69: ; preds = %67
%70 = tail call i32 @ENGINE_ctrl_cmd_string(i32* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %21, i32 0)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = tail call i32 @display_openssl_errors(i32 133)
%74 = tail call i32 @exit(i32 1)
unreachable
75: ; preds = %69, %67
%76 = tail call i32* @ENGINE_load_private_key(i32* %44, i8* %25, i32* null, i32* null)
%77 = icmp eq i32* %76, null
br i1 %77, label %78, label %83
78: ; preds = %75
%79 = load i32, i32* @stderr
%80 = tail call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %25)
%81 = tail call i32 @display_openssl_errors(i32 140)
%82 = tail call i32 @exit(i32 1)
unreachable
83: ; preds = %75
%84 = tail call i32* @ENGINE_load_public_key(i32* %44, i8* %27, i32* null, i32* null)
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %91
86: ; preds = %83
%87 = load i32, i32* @stderr
%88 = tail call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %27)
%89 = tail call i32 @display_openssl_errors(i32 147)
%90 = tail call i32 @exit(i32 1)
unreachable
91: ; preds = %83
%92 = tail call i32* @EVP_get_digestbyname(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%93 = tail call i32* (...) @EVP_MD_CTX_create()
%94 = tail call i64 @EVP_DigestInit(i32* %93, i32* %92)
%95 = icmp slt i64 %94, 1
br i1 %95, label %96, label %99
96: ; preds = %91
%97 = tail call i32 @display_openssl_errors(i32 157)
%98 = tail call i32 @exit(i32 1)
unreachable
99: ; preds = %91
%100 = tail call i64 @EVP_DigestUpdate(i32* %93, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 10)
%101 = icmp slt i64 %100, 1
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = tail call i32 @display_openssl_errors(i32 162)
%104 = tail call i32 @exit(i32 1)
unreachable
105: ; preds = %99
store i32 128, i32* %6
%106 = call i64 @EVP_DigestFinal(i32* %93, i8* %9, i32* %6)
%107 = icmp slt i64 %106, 1
br i1 %107, label %108, label %111
108: ; preds = %105
%109 = call i32 @display_openssl_errors(i32 168)
%110 = call i32 @exit(i32 1)
unreachable
111: ; preds = %105
%112 = call i32 @EVP_MD_CTX_destroy(i32* %93)
%113 = call i32* @EVP_PKEY_CTX_new(i32* %76, i32* %44)
%114 = icmp eq i32* %113, null
br i1 %114, label %115, label %120
115: ; preds = %111
%116 = load i32, i32* @stderr
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
%118 = call i32 @display_openssl_errors(i32 180)
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %111
%121 = call i64 @EVP_PKEY_sign_init(i32* %113)
%122 = icmp slt i64 %121, 1
br i1 %122, label %123, label %128
123: ; preds = %120
%124 = load i32, i32* @stderr
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
%126 = call i32 @display_openssl_errors(i32 186)
%127 = call i32 @exit(i32 1)
unreachable
128: ; preds = %120
%129 = load i32, i32* @RSA_PKCS1_PSS_PADDING
%130 = call i64 @EVP_PKEY_CTX_set_rsa_padding(i32* %113, i32 %129)
%131 = icmp slt i64 %130, 1
br i1 %131, label %132, label %137
132: ; preds = %128
%133 = load i32, i32* @stderr
%134 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
%135 = call i32 @display_openssl_errors(i32 192)
%136 = call i32 @exit(i32 1)
unreachable
137: ; preds = %128
%138 = call i64 @EVP_PKEY_CTX_set_signature_md(i32* %113, i32* %92)
%139 = icmp slt i64 %138, 1
br i1 %139, label %140, label %145
140: ; preds = %137
%141 = load i32, i32* @stderr
%142 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.14, i64 0, i64 0))
%143 = call i32 @display_openssl_errors(i32 198)
%144 = call i32 @exit(i32 1)
unreachable
145: ; preds = %137
store i64 4096, i64* %4
%146 = call i32 @EVP_MD_size(i32* %92)
%147 = call i64 @EVP_PKEY_sign(i32* %113, i8* %7, i64* %4, i8* %9, i32 %146)
%148 = icmp slt i64 %147, 1
br i1 %148, label %149, label %152
149: ; preds = %145
%150 = call i32 @display_openssl_errors(i32 205)
%151 = call i32 @exit(i32 1)
unreachable
152: ; preds = %145
%153 = call i32 @EVP_PKEY_CTX_free(i32* %113)
%154 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%155 = load i8*, i8** @OPENSSL_VERSION_TEXT
%156 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0), i8* %155)
%157 = call i32 @ENGINE_finish(i32* %44)
%158 = call i32 @CONF_modules_unload(i32 1)
ret i32 0
}