#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*/ EVP_PKEY_CTX;
typedef int /*<<< orphan*/ EVP_MD;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_asc2bn(int /*<<< orphan*/ **, char const *);
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
int EVP_PKEY_CTX_set0_rsa_oaep_label(int /*<<< orphan*/ *, unsigned char *,
                                     long);
int EVP_PKEY_CTX_set_rsa_keygen_bits(int /*<<< orphan*/ *, int);
int EVP_PKEY_CTX_set_rsa_keygen_pubexp(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int EVP_PKEY_CTX_set_rsa_mgf1_md(int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ const *);
int EVP_PKEY_CTX_set_rsa_oaep_md(int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ const *);
int EVP_PKEY_CTX_set_rsa_padding(int /*<<< orphan*/ *, int);
int EVP_PKEY_CTX_set_rsa_pss_saltlen(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *EVP_get_digestbyname(char const *);
int /*<<< orphan*/ OPENSSL_free(unsigned char *);
unsigned char *OPENSSL_hexstr2buf(char const *, long *);
int /*<<< orphan*/ RSA_F_PKEY_RSA_CTRL_STR;
int RSA_NO_PADDING;
int RSA_PKCS1_OAEP_PADDING;
int RSA_PKCS1_PADDING;
int RSA_PKCS1_PSS_PADDING;
int /*<<< orphan*/ RSA_R_INVALID_DIGEST;
int /*<<< orphan*/ RSA_R_UNKNOWN_PADDING_TYPE;
int /*<<< orphan*/ RSA_R_VALUE_MISSING;
int RSA_SSLV23_PADDING;
int RSA_X931_PADDING;
int /*<<< orphan*/ RSAerr(int /*<<< orphan*/, int /*<<< orphan*/);
int atoi(char const *);
scalar_t__ strcmp(char const *, char *);
int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) {
  if (!value) {
    RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_VALUE_MISSING);
    return 0;
  }
  if (strcmp(type, "rsa_padding_mode") == 0) {
    int pm;
    if (strcmp(value, "pkcs1") == 0)
      pm = RSA_PKCS1_PADDING;
    else if (strcmp(value, "sslv23") == 0)
      pm = RSA_SSLV23_PADDING;
    else if (strcmp(value, "none") == 0)
      pm = RSA_NO_PADDING;
    else if (strcmp(value, "oeap") == 0)
      pm = RSA_PKCS1_OAEP_PADDING;
    else if (strcmp(value, "oaep") == 0)
      pm = RSA_PKCS1_OAEP_PADDING;
    else if (strcmp(value, "x931") == 0)
      pm = RSA_X931_PADDING;
    else if (strcmp(value, "pss") == 0)
      pm = RSA_PKCS1_PSS_PADDING;
    else {
      RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_UNKNOWN_PADDING_TYPE);
      return -2;
    }
    return EVP_PKEY_CTX_set_rsa_padding(ctx, pm);
  }
  if (strcmp(type, "rsa_pss_saltlen") == 0) {
    int saltlen;
    saltlen = atoi(value);
    return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen);
  }
  if (strcmp(type, "rsa_keygen_bits") == 0) {
    int nbits;
    nbits = atoi(value);
    return EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, nbits);
  }
  if (strcmp(type, "rsa_keygen_pubexp") == 0) {
    int ret;
    BIGNUM *pubexp = NULL;
    if (!BN_asc2bn(&pubexp, value))
      return 0;
    ret = EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp);
    if (ret <= 0)
      BN_free(pubexp);
    return ret;
  }
  if (strcmp(type, "rsa_mgf1_md") == 0) {
    const EVP_MD *md;
    if ((md = EVP_get_digestbyname(value)) == NULL) {
      RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_INVALID_DIGEST);
      return 0;
    }
    return EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md);
  }
  if (strcmp(type, "rsa_oaep_md") == 0) {
    const EVP_MD *md;
    if ((md = EVP_get_digestbyname(value)) == NULL) {
      RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_INVALID_DIGEST);
      return 0;
    }
    return EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md);
  }
  if (strcmp(type, "rsa_oaep_label") == 0) {
    unsigned char *lab;
    long lablen;
    int ret;
    lab = OPENSSL_hexstr2buf(value, &lablen);
    if (!lab)
      return 0;
    ret = EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, lab, lablen);
    if (ret <= 0)
      OPENSSL_free(lab);
    return ret;
  }
  return -2;
}


x86 assembly (clang, -O0):
<pkey_rsa_ctrl_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1232 <pkey_rsa_ctrl_str+0x42>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
mov    0x2d99(%rip),%rax
mov    (%rax),%esi
call   10d0 <RSAerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x18(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    13ce <pkey_rsa_ctrl_str+0x1de>
mov    -0x20(%rbp),%rdi
lea    0xdba(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1277 <pkey_rsa_ctrl_str+0x87>
mov    0x2d2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    13ba <pkey_rsa_ctrl_str+0x1ca>
mov    -0x20(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12a2 <pkey_rsa_ctrl_str+0xb2>
mov    0x2d28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    13b5 <pkey_rsa_ctrl_str+0x1c5>
mov    -0x20(%rbp),%rdi
lea    0xd71(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12cd <pkey_rsa_ctrl_str+0xdd>
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    13b0 <pkey_rsa_ctrl_str+0x1c0>
mov    -0x20(%rbp),%rdi
lea    0xd4b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12f8 <pkey_rsa_ctrl_str+0x108>
mov    0x2ce2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    13ab <pkey_rsa_ctrl_str+0x1bb>
mov    -0x20(%rbp),%rdi
lea    0xd25(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1323 <pkey_rsa_ctrl_str+0x133>
mov    0x2cb7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    13a6 <pkey_rsa_ctrl_str+0x1b6>
mov    -0x20(%rbp),%rdi
lea    0xcff(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    134e <pkey_rsa_ctrl_str+0x15e>
mov    0x2c9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    13a1 <pkey_rsa_ctrl_str+0x1b1>
mov    -0x20(%rbp),%rdi
lea    0xcd9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1379 <pkey_rsa_ctrl_str+0x189>
mov    0x2c21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    139c <pkey_rsa_ctrl_str+0x1ac>
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
mov    0x2c67(%rip),%rax
mov    (%rax),%esi
call   10d0 <RSAerr@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
jmp    13a1 <pkey_rsa_ctrl_str+0x1b1>
jmp    13a6 <pkey_rsa_ctrl_str+0x1b6>
jmp    13ab <pkey_rsa_ctrl_str+0x1bb>
jmp    13b0 <pkey_rsa_ctrl_str+0x1c0>
jmp    13b5 <pkey_rsa_ctrl_str+0x1c5>
jmp    13ba <pkey_rsa_ctrl_str+0x1ca>
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10c0 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    %eax,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x18(%rbp),%rdi
lea    0xc5d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1408 <pkey_rsa_ctrl_str+0x218>
mov    -0x20(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1100 <EVP_PKEY_CTX_set_rsa_pss_saltlen@plt>
mov    %eax,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x18(%rbp),%rdi
lea    0xc33(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1442 <pkey_rsa_ctrl_str+0x252>
mov    -0x20(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1060 <EVP_PKEY_CTX_set_rsa_keygen_bits@plt>
mov    %eax,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x18(%rbp),%rdi
lea    0xc09(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    14b4 <pkey_rsa_ctrl_str+0x2c4>
movq   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rsi
lea    -0x38(%rbp),%rdi
call   1030 <BN_asc2bn@plt>
cmp    $0x0,%eax
jne    1486 <pkey_rsa_ctrl_str+0x296>
movl   $0x0,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10a0 <EVP_PKEY_CTX_set_rsa_keygen_pubexp@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jg     14a9 <pkey_rsa_ctrl_str+0x2b9>
mov    -0x38(%rbp),%rdi
call   1040 <BN_free@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x18(%rbp),%rdi
lea    0xba9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    151d <pkey_rsa_ctrl_str+0x32d>
mov    -0x20(%rbp),%rdi
call   1090 <EVP_get_digestbyname@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1508 <pkey_rsa_ctrl_str+0x318>
mov    0x2abc(%rip),%rax
mov    (%rax),%edi
mov    0x2abb(%rip),%rax
mov    (%rax),%esi
call   10d0 <RSAerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10b0 <EVP_PKEY_CTX_set_rsa_mgf1_md@plt>
mov    %eax,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x18(%rbp),%rdi
lea    0xb4c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1586 <pkey_rsa_ctrl_str+0x396>
mov    -0x20(%rbp),%rdi
call   1090 <EVP_get_digestbyname@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1571 <pkey_rsa_ctrl_str+0x381>
mov    0x2a53(%rip),%rax
mov    (%rax),%edi
mov    0x2a52(%rip),%rax
mov    (%rax),%esi
call   10d0 <RSAerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1080 <EVP_PKEY_CTX_set_rsa_oaep_md@plt>
mov    %eax,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x18(%rbp),%rdi
lea    0xaef(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    15fa <pkey_rsa_ctrl_str+0x40a>
mov    -0x20(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1070 <OPENSSL_hexstr2buf@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    15c8 <pkey_rsa_ctrl_str+0x3d8>
movl   $0x0,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1110 <EVP_PKEY_CTX_set0_rsa_oaep_label@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jg     15ef <pkey_rsa_ctrl_str+0x3ff>
mov    -0x50(%rbp),%rdi
call   10f0 <OPENSSL_free@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1601 <pkey_rsa_ctrl_str+0x411>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkey_rsa_ctrl_str>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %rdx,%rdx
je     12e9 <pkey_rsa_ctrl_str+0xf9>
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xdee(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     130e <pkey_rsa_ctrl_str+0x11e>
lea    0xe0c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     13de <pkey_rsa_ctrl_str+0x1ee>
lea    0xe04(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     13f9 <pkey_rsa_ctrl_str+0x209>
lea    0xdfc(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     141d <pkey_rsa_ctrl_str+0x22d>
lea    0xdf6(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     146a <pkey_rsa_ctrl_str+0x27a>
lea    0xdea(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     14a5 <pkey_rsa_ctrl_str+0x2b5>
lea    0xdde(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0xfffffffe,%ebx
test   %rax,%rax
jne    1302 <pkey_rsa_ctrl_str+0x112>
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1070 <OPENSSL_hexstr2buf@plt>
test   %rax,%rax
je     1300 <pkey_rsa_ctrl_str+0x110>
mov    %rax,%r15
mov    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    %rax,%rsi
call   1110 <EVP_PKEY_CTX_set0_rsa_oaep_label@plt>
mov    %eax,%ebx
test   %eax,%eax
jg     1302 <pkey_rsa_ctrl_str+0x112>
mov    %r15,%rdi
call   10f0 <OPENSSL_free@plt>
jmp    1302 <pkey_rsa_ctrl_str+0x112>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
mov    0x2cbf(%rip),%rax
mov    (%rax),%esi
call   10d0 <RSAerr@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xcfc(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1414 <pkey_rsa_ctrl_str+0x224>
lea    0xcea(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1461 <pkey_rsa_ctrl_str+0x271>
lea    0xcd9(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     148b <pkey_rsa_ctrl_str+0x29b>
lea    0xcc6(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
mov    0x2c64(%rip),%rbx
test   %rax,%rax
je     1492 <pkey_rsa_ctrl_str+0x2a2>
lea    0xcac(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1492 <pkey_rsa_ctrl_str+0x2a2>
lea    0xc99(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     14db <pkey_rsa_ctrl_str+0x2eb>
lea    0xc86(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     14e4 <pkey_rsa_ctrl_str+0x2f4>
mov    0x2be4(%rip),%rax
mov    (%rax),%edi
mov    0x2c23(%rip),%rax
mov    (%rax),%esi
call   10d0 <RSAerr@plt>
mov    $0xfffffffe,%ebx
jmp    1302 <pkey_rsa_ctrl_str+0x112>
mov    %r15,%rdi
call   10e0 <atoi@plt>
mov    %r14,%rdi
mov    %eax,%esi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1100 <EVP_PKEY_CTX_set_rsa_pss_saltlen@plt>
mov    %r15,%rdi
call   10e0 <atoi@plt>
mov    %r14,%rdi
mov    %eax,%esi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <EVP_PKEY_CTX_set_rsa_keygen_bits@plt>
mov    0x2b7d(%rip),%rbx
jmp    1492 <pkey_rsa_ctrl_str+0x2a2>
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    %r15,%rsi
call   1030 <BN_asc2bn@plt>
test   %eax,%eax
je     1300 <pkey_rsa_ctrl_str+0x110>
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
call   10a0 <EVP_PKEY_CTX_set_rsa_keygen_pubexp@plt>
mov    %eax,%ebx
test   %eax,%eax
jg     1302 <pkey_rsa_ctrl_str+0x112>
mov    0x8(%rsp),%rdi
call   1040 <BN_free@plt>
jmp    1302 <pkey_rsa_ctrl_str+0x112>
mov    0x2b58(%rip),%rbx
jmp    1492 <pkey_rsa_ctrl_str+0x2a2>
mov    %r15,%rdi
call   1090 <EVP_get_digestbyname@plt>
test   %rax,%rax
je     14c6 <pkey_rsa_ctrl_str+0x2d6>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    10b0 <EVP_PKEY_CTX_set_rsa_mgf1_md@plt>
mov    0x2b46(%rip),%rbx
mov    (%rbx),%esi
mov    %r14,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    10c0 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    %r15,%rdi
call   1090 <EVP_get_digestbyname@plt>
test   %rax,%rax
je     14c6 <pkey_rsa_ctrl_str+0x2d6>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1080 <EVP_PKEY_CTX_set_rsa_oaep_md@plt>
mov    0x2adb(%rip),%rax
mov    (%rax),%edi
mov    0x2ada(%rip),%rax
jmp    12f9 <pkey_rsa_ctrl_str+0x109>
mov    0x2afe(%rip),%rbx
jmp    1492 <pkey_rsa_ctrl_str+0x2a2>
mov    0x2aa5(%rip),%rbx
jmp    1492 <pkey_rsa_ctrl_str+0x2a2>

LLVM IR (-O0):
@RSA_F_PKEY_RSA_CTRL_STR = global i32 0
@RSA_R_VALUE_MISSING = global i32 0
@.str = [17 x i8] c"rsa_padding_mode\00"
@.str.1 = [6 x i8] c"pkcs1\00"
@RSA_PKCS1_PADDING = global i32 0
@.str.2 = [7 x i8] c"sslv23\00"
@RSA_SSLV23_PADDING = global i32 0
@.str.3 = [5 x i8] c"none\00"
@RSA_NO_PADDING = global i32 0
@.str.4 = [5 x i8] c"oeap\00"
@RSA_PKCS1_OAEP_PADDING = global i32 0
@.str.5 = [5 x i8] c"oaep\00"
@.str.6 = [5 x i8] c"x931\00"
@RSA_X931_PADDING = global i32 0
@.str.7 = [4 x i8] c"pss\00"
@RSA_PKCS1_PSS_PADDING = global i32 0
@RSA_R_UNKNOWN_PADDING_TYPE = global i32 0
@.str.8 = [16 x i8] c"rsa_pss_saltlen\00"
@.str.9 = [16 x i8] c"rsa_keygen_bits\00"
@.str.10 = [18 x i8] c"rsa_keygen_pubexp\00"
@.str.11 = [12 x i8] c"rsa_mgf1_md\00"
@RSA_R_INVALID_DIGEST = global i32 0
@.str.12 = [12 x i8] c"rsa_oaep_md\00"
@.str.13 = [15 x i8] c"rsa_oaep_label\00"
define i32 @pkey_rsa_ctrl_str(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%18 = load i8*, i8** %7
%19 = icmp ne i8* %18, null
br i1 %19, label %24, label %20
20: ; preds = %3
%21 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%22 = load i32, i32* @RSA_R_VALUE_MISSING
%23 = call i32 @RSAerr(i32 %21, i32 %22)
store i32 0, i32* %4
br label %179
24: ; preds = %3
%25 = load i8*, i8** %6
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %84
28: ; preds = %24
%29 = load i8*, i8** %7
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = load i32, i32* @RSA_PKCS1_PADDING
store i32 %33, i32* %8
br label %80
34: ; preds = %28
%35 = load i8*, i8** %7
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = load i32, i32* @RSA_SSLV23_PADDING
store i32 %39, i32* %8
br label %79
40: ; preds = %34
%41 = load i8*, i8** %7
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = load i32, i32* @RSA_NO_PADDING
store i32 %45, i32* %8
br label %78
46: ; preds = %40
%47 = load i8*, i8** %7
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = load i32, i32* @RSA_PKCS1_OAEP_PADDING
store i32 %51, i32* %8
br label %77
52: ; preds = %46
%53 = load i8*, i8** %7
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = load i32, i32* @RSA_PKCS1_OAEP_PADDING
store i32 %57, i32* %8
br label %76
58: ; preds = %52
%59 = load i8*, i8** %7
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = load i32, i32* @RSA_X931_PADDING
store i32 %63, i32* %8
br label %75
64: ; preds = %58
%65 = load i8*, i8** %7
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = load i32, i32* @RSA_PKCS1_PSS_PADDING
store i32 %69, i32* %8
br label %74
70: ; preds = %64
%71 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%72 = load i32, i32* @RSA_R_UNKNOWN_PADDING_TYPE
%73 = call i32 @RSAerr(i32 %71, i32 %72)
store i32 -2, i32* %4
br label %179
74: ; preds = %68
br label %75
75: ; preds = %74, %62
br label %76
76: ; preds = %75, %56
br label %77
77: ; preds = %76, %50
br label %78
78: ; preds = %77, %44
br label %79
79: ; preds = %78, %38
br label %80
80: ; preds = %79, %32
%81 = load i32*, i32** %5
%82 = load i32, i32* %8
%83 = call i32 @EVP_PKEY_CTX_set_rsa_padding(i32* %81, i32 %82)
store i32 %83, i32* %4
br label %179
84: ; preds = %24
%85 = load i8*, i8** %6
%86 = call i64 @strcmp(i8* %85, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %94
88: ; preds = %84
%89 = load i8*, i8** %7
%90 = call i32 @atoi(i8* %89)
store i32 %90, i32* %9
%91 = load i32*, i32** %5
%92 = load i32, i32* %9
%93 = call i32 @EVP_PKEY_CTX_set_rsa_pss_saltlen(i32* %91, i32 %92)
store i32 %93, i32* %4
br label %179
94: ; preds = %84
%95 = load i8*, i8** %6
%96 = call i64 @strcmp(i8* %95, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %104
98: ; preds = %94
%99 = load i8*, i8** %7
%100 = call i32 @atoi(i8* %99)
store i32 %100, i32* %10
%101 = load i32*, i32** %5
%102 = load i32, i32* %10
%103 = call i32 @EVP_PKEY_CTX_set_rsa_keygen_bits(i32* %101, i32 %102)
store i32 %103, i32* %4
br label %179
104: ; preds = %94
%105 = load i8*, i8** %6
%106 = call i64 @strcmp(i8* %105, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %124
108: ; preds = %104
store i32* null, i32** %12
%109 = load i8*, i8** %7
%110 = call i32 @BN_asc2bn(i32** %12, i8* %109)
%111 = icmp ne i32 %110, 0
br i1 %111, label %113, label %112
112: ; preds = %108
store i32 0, i32* %4
br label %179
113: ; preds = %108
%114 = load i32*, i32** %5
%115 = load i32*, i32** %12
%116 = call i32 @EVP_PKEY_CTX_set_rsa_keygen_pubexp(i32* %114, i32* %115)
store i32 %116, i32* %11
%117 = load i32, i32* %11
%118 = icmp sle i32 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %113
%120 = load i32*, i32** %12
%121 = call i32 @BN_free(i32* %120)
br label %122
122: ; preds = %119, %113
%123 = load i32, i32* %11
store i32 %123, i32* %4
br label %179
124: ; preds = %104
%125 = load i8*, i8** %6
%126 = call i64 @strcmp(i8* %125, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%127 = icmp eq i64 %126, 0
br i1 %127, label %128, label %140
128: ; preds = %124
%129 = load i8*, i8** %7
%130 = call i32* @EVP_get_digestbyname(i8* %129)
store i32* %130, i32** %13
%131 = icmp eq i32* %130, null
br i1 %131, label %132, label %136
132: ; preds = %128
%133 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%134 = load i32, i32* @RSA_R_INVALID_DIGEST
%135 = call i32 @RSAerr(i32 %133, i32 %134)
store i32 0, i32* %4
br label %179
136: ; preds = %128
%137 = load i32*, i32** %5
%138 = load i32*, i32** %13
%139 = call i32 @EVP_PKEY_CTX_set_rsa_mgf1_md(i32* %137, i32* %138)
store i32 %139, i32* %4
br label %179
140: ; preds = %124
%141 = load i8*, i8** %6
%142 = call i64 @strcmp(i8* %141, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%143 = icmp eq i64 %142, 0
br i1 %143, label %144, label %156
144: ; preds = %140
%145 = load i8*, i8** %7
%146 = call i32* @EVP_get_digestbyname(i8* %145)
store i32* %146, i32** %14
%147 = icmp eq i32* %146, null
br i1 %147, label %148, label %152
148: ; preds = %144
%149 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%150 = load i32, i32* @RSA_R_INVALID_DIGEST
%151 = call i32 @RSAerr(i32 %149, i32 %150)
store i32 0, i32* %4
br label %179
152: ; preds = %144
%153 = load i32*, i32** %5
%154 = load i32*, i32** %14
%155 = call i32 @EVP_PKEY_CTX_set_rsa_oaep_md(i32* %153, i32* %154)
store i32 %155, i32* %4
br label %179
156: ; preds = %140
%157 = load i8*, i8** %6
%158 = call i64 @strcmp(i8* %157, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0))
%159 = icmp eq i64 %158, 0
br i1 %159, label %160, label %178
160: ; preds = %156
%161 = load i8*, i8** %7
%162 = call i8* @OPENSSL_hexstr2buf(i8* %161, i64* %16)
store i8* %162, i8** %15
%163 = load i8*, i8** %15
%164 = icmp ne i8* %163, null
br i1 %164, label %166, label %165
165: ; preds = %160
store i32 0, i32* %4
br label %179
166: ; preds = %160
%167 = load i32*, i32** %5
%168 = load i8*, i8** %15
%169 = load i64, i64* %16
%170 = call i32 @EVP_PKEY_CTX_set0_rsa_oaep_label(i32* %167, i8* %168, i64 %169)
store i32 %170, i32* %17
%171 = load i32, i32* %17
%172 = icmp sle i32 %171, 0
br i1 %172, label %173, label %176
173: ; preds = %166
%174 = load i8*, i8** %15
%175 = call i32 @OPENSSL_free(i8* %174)
br label %176
176: ; preds = %173, %166
%177 = load i32, i32* %17
store i32 %177, i32* %4
br label %179
178: ; preds = %156
store i32 -2, i32* %4
br label %179
179: ; preds = %178, %176, %165, %152, %148, %136, %132, %122, %112, %98, %88, %80, %70, %20
%180 = load i32, i32* %4
ret i32 %180
}

LLVM IR (-O2):
@RSA_F_PKEY_RSA_CTRL_STR = global i32 0
@RSA_R_VALUE_MISSING = global i32 0
@.str = [17 x i8] c"rsa_padding_mode\00"
@.str.1 = [6 x i8] c"pkcs1\00"
@RSA_PKCS1_PADDING = global i32 0
@.str.2 = [7 x i8] c"sslv23\00"
@RSA_SSLV23_PADDING = global i32 0
@.str.3 = [5 x i8] c"none\00"
@RSA_NO_PADDING = global i32 0
@.str.4 = [5 x i8] c"oeap\00"
@RSA_PKCS1_OAEP_PADDING = global i32 0
@.str.5 = [5 x i8] c"oaep\00"
@.str.6 = [5 x i8] c"x931\00"
@RSA_X931_PADDING = global i32 0
@.str.7 = [4 x i8] c"pss\00"
@RSA_PKCS1_PSS_PADDING = global i32 0
@RSA_R_UNKNOWN_PADDING_TYPE = global i32 0
@.str.8 = [16 x i8] c"rsa_pss_saltlen\00"
@.str.9 = [16 x i8] c"rsa_keygen_bits\00"
@.str.10 = [18 x i8] c"rsa_keygen_pubexp\00"
@.str.11 = [12 x i8] c"rsa_mgf1_md\00"
@RSA_R_INVALID_DIGEST = global i32 0
@.str.12 = [12 x i8] c"rsa_oaep_md\00"
@.str.13 = [15 x i8] c"rsa_oaep_label\00"
define i32 @pkey_rsa_ctrl_str(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i64
%6 = icmp eq i8* %2, null
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%9 = load i32, i32* @RSA_R_VALUE_MISSING
%10 = tail call i32 @RSAerr(i32 %8, i32 %9)
br label %110
11: ; preds = %3
%12 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %43
14: ; preds = %11
%15 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %39, label %17
17: ; preds = %14
%18 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %39, label %20
20: ; preds = %17
%21 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %39, label %23
23: ; preds = %20
%24 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %39, label %26
26: ; preds = %23
%27 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %39, label %29
29: ; preds = %26
%30 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %39, label %32
32: ; preds = %29
%33 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %32
%36 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%37 = load i32, i32* @RSA_R_UNKNOWN_PADDING_TYPE
%38 = tail call i32 @RSAerr(i32 %36, i32 %37)
br label %110
39: ; preds = %32, %29, %26, %23, %20, %17, %14
%40 = phi i32* [ @RSA_PKCS1_PADDING, %14 ], [ @RSA_SSLV23_PADDING, %17 ], [ @RSA_NO_PADDING, %20 ], [ @RSA_PKCS1_OAEP_PADDING, %23 ], [ @RSA_PKCS1_OAEP_PADDING, %26 ], [ @RSA_X931_PADDING, %29 ], [ @RSA_PKCS1_PSS_PADDING, %32 ]
%41 = load i32, i32* %40
%42 = tail call i32 @EVP_PKEY_CTX_set_rsa_padding(i32* %0, i32 %41)
br label %110
43: ; preds = %11
%44 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = tail call i32 @atoi(i8* %2)
%48 = tail call i32 @EVP_PKEY_CTX_set_rsa_pss_saltlen(i32* %0, i32 %47)
br label %110
49: ; preds = %43
%50 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = tail call i32 @atoi(i8* %2)
%54 = tail call i32 @EVP_PKEY_CTX_set_rsa_keygen_bits(i32* %0, i32 %53)
br label %110
55: ; preds = %49
%56 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %71
58: ; preds = %55
%59 = bitcast i32** %4 to i8*
store i32* null, i32** %4
%60 = call i32 @BN_asc2bn(i32** %4, i8* %2)
%61 = icmp eq i32 %60, 0
br i1 %61, label %69, label %62
62: ; preds = %58
%63 = load i32*, i32** %4
%64 = call i32 @EVP_PKEY_CTX_set_rsa_keygen_pubexp(i32* %0, i32* %63)
%65 = icmp slt i32 %64, 1
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i32*, i32** %4
%68 = call i32 @BN_free(i32* %67)
br label %69
69: ; preds = %62, %66, %58
%70 = phi i32 [ 0, %58 ], [ %64, %66 ], [ %64, %62 ]
br label %110
71: ; preds = %55
%72 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %83
74: ; preds = %71
%75 = tail call i32* @EVP_get_digestbyname(i8* %2)
%76 = icmp eq i32* %75, null
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%79 = load i32, i32* @RSA_R_INVALID_DIGEST
%80 = tail call i32 @RSAerr(i32 %78, i32 %79)
br label %110
81: ; preds = %74
%82 = tail call i32 @EVP_PKEY_CTX_set_rsa_mgf1_md(i32* %0, i32* %75)
br label %110
83: ; preds = %71
%84 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %95
86: ; preds = %83
%87 = tail call i32* @EVP_get_digestbyname(i8* %2)
%88 = icmp eq i32* %87, null
br i1 %88, label %89, label %93
89: ; preds = %86
%90 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%91 = load i32, i32* @RSA_R_INVALID_DIGEST
%92 = tail call i32 @RSAerr(i32 %90, i32 %91)
br label %110
93: ; preds = %86
%94 = tail call i32 @EVP_PKEY_CTX_set_rsa_oaep_md(i32* %0, i32* %87)
br label %110
95: ; preds = %83
%96 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0))
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %110
98: ; preds = %95
%99 = bitcast i64* %5 to i8*
%100 = call i8* @OPENSSL_hexstr2buf(i8* %2, i64* %5)
%101 = icmp eq i8* %100, null
br i1 %101, label %108, label %102
102: ; preds = %98
%103 = load i64, i64* %5
%104 = call i32 @EVP_PKEY_CTX_set0_rsa_oaep_label(i32* %0, i8* %100, i64 %103)
%105 = icmp slt i32 %104, 1
br i1 %105, label %106, label %108
106: ; preds = %102
%107 = call i32 @OPENSSL_free(i8* %100)
br label %108
108: ; preds = %102, %106, %98
%109 = phi i32 [ 0, %98 ], [ %104, %106 ], [ %104, %102 ]
br label %110
110: ; preds = %95, %89, %93, %77, %81, %35, %39, %108, %69, %52, %46, %7
%111 = phi i32 [ %48, %46 ], [ %54, %52 ], [ %70, %69 ], [ %109, %108 ], [ 0, %7 ], [ %42, %39 ], [ -2, %35 ], [ 0, %77 ], [ %82, %81 ], [ 0, %89 ], [ %94, %93 ], [ -2, %95 ]
ret i32 %111
}