#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*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_asc2bn(int /*<<< orphan*/ **, char const *);
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
scalar_t__ ERANGE;
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_padding(int /*<<< orphan*/ *, int);
int EVP_PKEY_CTX_set_rsa_pss_saltlen(int /*<<< orphan*/ *, int);
long INT_MAX;
long INT_MIN;
long LONG_MAX;
long LONG_MIN;
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_UNKNOWN_PADDING_TYPE;
int /*<<< orphan*/ RSA_R_VALUE_MISSING;
int RSA_SSLV23_PADDING;
int RSA_X931_PADDING;
int /*<<< orphan*/ RSAerr(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ strcmp(char const *, char *);
long strtol(char const *, char **, int);
int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) {
  long lval;
  char *ep;
  if (!value) {
    RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_VALUE_MISSING);
    return 0;
  }
  if (!strcmp(type, "rsa_padding_mode")) {
    int pm;
    if (!strcmp(value, "pkcs1"))
      pm = RSA_PKCS1_PADDING;
    else if (!strcmp(value, "sslv23"))
      pm = RSA_SSLV23_PADDING;
    else if (!strcmp(value, "none"))
      pm = RSA_NO_PADDING;
    else if (!strcmp(value, "oeap"))
      pm = RSA_PKCS1_OAEP_PADDING;
    else if (!strcmp(value, "oaep"))
      pm = RSA_PKCS1_OAEP_PADDING;
    else if (!strcmp(value, "x931"))
      pm = RSA_X931_PADDING;
    else if (!strcmp(value, "pss"))
      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")) {
    int saltlen;
    errno = 0;
    lval = strtol(value, &ep, 10);
    if (value[0] == '\0' || *ep != '\0')
      goto not_a_number;
    if ((errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) ||
        (lval > INT_MAX || lval < INT_MIN))
      goto out_of_range;
    saltlen = lval;
    return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen);
  }
  if (!strcmp(type, "rsa_keygen_bits")) {
    int nbits;
    errno = 0;
    lval = strtol(value, &ep, 10);
    if (value[0] == '\0' || *ep != '\0')
      goto not_a_number;
    if ((errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) ||
        (lval > INT_MAX || lval < INT_MIN))
      goto out_of_range;
    nbits = lval;
    return EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, nbits);
  }
  if (!strcmp(type, "rsa_keygen_pubexp")) {
    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;
  }
not_a_number:
out_of_range:
  return -2;
}


x86 assembly (clang, -O0):
<pkey_rsa_ctrl_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11d2 <pkey_rsa_ctrl_str+0x42>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
mov    0x2dc9(%rip),%rax
mov    (%rax),%esi
call   10a0 <RSAerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    15c0 <pkey_rsa_ctrl_str+0x430>
mov    -0x18(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1366 <pkey_rsa_ctrl_str+0x1d6>
mov    -0x20(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1215 <pkey_rsa_ctrl_str+0x85>
mov    0x2d65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1352 <pkey_rsa_ctrl_str+0x1c2>
mov    -0x20(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    123f <pkey_rsa_ctrl_str+0xaf>
mov    0x2d6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    134d <pkey_rsa_ctrl_str+0x1bd>
mov    -0x20(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1269 <pkey_rsa_ctrl_str+0xd9>
mov    0x2d79(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1348 <pkey_rsa_ctrl_str+0x1b8>
mov    -0x20(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1293 <pkey_rsa_ctrl_str+0x103>
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1343 <pkey_rsa_ctrl_str+0x1b3>
mov    -0x20(%rbp),%rdi
lea    0xd8a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12bd <pkey_rsa_ctrl_str+0x12d>
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    133e <pkey_rsa_ctrl_str+0x1ae>
mov    -0x20(%rbp),%rdi
lea    0xd65(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12e7 <pkey_rsa_ctrl_str+0x157>
mov    0x2d03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1339 <pkey_rsa_ctrl_str+0x1a9>
mov    -0x20(%rbp),%rdi
lea    0xd40(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1311 <pkey_rsa_ctrl_str+0x181>
mov    0x2c61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1334 <pkey_rsa_ctrl_str+0x1a4>
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
mov    0x2ccf(%rip),%rax
mov    (%rax),%esi
call   10a0 <RSAerr@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    15c0 <pkey_rsa_ctrl_str+0x430>
jmp    1339 <pkey_rsa_ctrl_str+0x1a9>
jmp    133e <pkey_rsa_ctrl_str+0x1ae>
jmp    1343 <pkey_rsa_ctrl_str+0x1b3>
jmp    1348 <pkey_rsa_ctrl_str+0x1b8>
jmp    134d <pkey_rsa_ctrl_str+0x1bd>
jmp    1352 <pkey_rsa_ctrl_str+0x1c2>
mov    -0x10(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1090 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    %eax,-0x4(%rbp)
jmp    15c0 <pkey_rsa_ctrl_str+0x430>
mov    -0x18(%rbp),%rdi
lea    0xcc5(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1452 <pkey_rsa_ctrl_str+0x2c2>
mov    0x2c0a(%rip),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13c3 <pkey_rsa_ctrl_str+0x233>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13c8 <pkey_rsa_ctrl_str+0x238>
jmp    15b4 <pkey_rsa_ctrl_str+0x424>
mov    0x2bc1(%rip),%rax
mov    (%rax),%rax
mov    0x2bd7(%rip),%rcx
cmp    (%rcx),%rax
jne    140a <pkey_rsa_ctrl_str+0x27a>
mov    -0x28(%rbp),%rax
mov    0x2bab(%rip),%rcx
cmp    (%rcx),%rax
je     1432 <pkey_rsa_ctrl_str+0x2a2>
mov    -0x28(%rbp),%rax
mov    0x2bbf(%rip),%rcx
cmp    (%rcx),%rax
je     1432 <pkey_rsa_ctrl_str+0x2a2>
mov    -0x28(%rbp),%rax
mov    0x2bbb(%rip),%rcx
cmp    (%rcx),%rax
jg     1432 <pkey_rsa_ctrl_str+0x2a2>
mov    -0x28(%rbp),%rax
mov    0x2b8f(%rip),%rcx
cmp    (%rcx),%rax
jge    1437 <pkey_rsa_ctrl_str+0x2a7>
jmp    15b9 <pkey_rsa_ctrl_str+0x429>
mov    -0x28(%rbp),%rax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   10b0 <EVP_PKEY_CTX_set_rsa_pss_saltlen@plt>
mov    %eax,-0x4(%rbp)
jmp    15c0 <pkey_rsa_ctrl_str+0x430>
mov    -0x18(%rbp),%rdi
lea    0xbe9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    153e <pkey_rsa_ctrl_str+0x3ae>
mov    0x2b1e(%rip),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     14af <pkey_rsa_ctrl_str+0x31f>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     14b4 <pkey_rsa_ctrl_str+0x324>
jmp    15b4 <pkey_rsa_ctrl_str+0x424>
mov    0x2ad5(%rip),%rax
mov    (%rax),%rax
mov    0x2aeb(%rip),%rcx
cmp    (%rcx),%rax
jne    14f6 <pkey_rsa_ctrl_str+0x366>
mov    -0x28(%rbp),%rax
mov    0x2abf(%rip),%rcx
cmp    (%rcx),%rax
je     151e <pkey_rsa_ctrl_str+0x38e>
mov    -0x28(%rbp),%rax
mov    0x2ad3(%rip),%rcx
cmp    (%rcx),%rax
je     151e <pkey_rsa_ctrl_str+0x38e>
mov    -0x28(%rbp),%rax
mov    0x2acf(%rip),%rcx
cmp    (%rcx),%rax
jg     151e <pkey_rsa_ctrl_str+0x38e>
mov    -0x28(%rbp),%rax
mov    0x2aa3(%rip),%rcx
cmp    (%rcx),%rax
jge    1523 <pkey_rsa_ctrl_str+0x393>
jmp    15b9 <pkey_rsa_ctrl_str+0x429>
mov    -0x28(%rbp),%rax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1060 <EVP_PKEY_CTX_set_rsa_keygen_bits@plt>
mov    %eax,-0x4(%rbp)
jmp    15c0 <pkey_rsa_ctrl_str+0x430>
mov    -0x18(%rbp),%rdi
lea    0xb0d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    15af <pkey_rsa_ctrl_str+0x41f>
movq   $0x0,-0x48(%rbp)
mov    -0x20(%rbp),%rsi
lea    -0x48(%rbp),%rdi
call   1030 <BN_asc2bn@plt>
cmp    $0x0,%eax
jne    1581 <pkey_rsa_ctrl_str+0x3f1>
movl   $0x0,-0x4(%rbp)
jmp    15c0 <pkey_rsa_ctrl_str+0x430>
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1080 <EVP_PKEY_CTX_set_rsa_keygen_pubexp@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jg     15a4 <pkey_rsa_ctrl_str+0x414>
mov    -0x48(%rbp),%rdi
call   1040 <BN_free@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15c0 <pkey_rsa_ctrl_str+0x430>
jmp    15b4 <pkey_rsa_ctrl_str+0x424>
jmp    15b9 <pkey_rsa_ctrl_str+0x429>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkey_rsa_ctrl_str>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rdx,%rdx
je     123a <pkey_rsa_ctrl_str+0xaa>
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%r14
lea    0xe50(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1260 <pkey_rsa_ctrl_str+0xd0>
lea    0xe6f(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1329 <pkey_rsa_ctrl_str+0x199>
lea    0xe68(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     13c5 <pkey_rsa_ctrl_str+0x235>
lea    0xe61(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
mov    $0xfffffffe,%ebp
test   %eax,%eax
jne    1253 <pkey_rsa_ctrl_str+0xc3>
movq   $0x0,(%rsp)
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <BN_asc2bn@plt>
test   %eax,%eax
je     1251 <pkey_rsa_ctrl_str+0xc1>
mov    (%rsp),%rsi
mov    %r14,%rdi
call   1080 <EVP_PKEY_CTX_set_rsa_keygen_pubexp@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     1253 <pkey_rsa_ctrl_str+0xc3>
mov    (%rsp),%rdi
call   1040 <BN_free@plt>
jmp    1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2d3f(%rip),%rax
mov    (%rax),%edi
mov    0x2d3e(%rip),%rax
mov    (%rax),%esi
call   10a0 <RSAerr@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdaa(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1461 <pkey_rsa_ctrl_str+0x2d1>
lea    0xd99(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     146a <pkey_rsa_ctrl_str+0x2da>
lea    0xd89(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1473 <pkey_rsa_ctrl_str+0x2e3>
lea    0xd77(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    0x2d0d(%rip),%rbp
test   %eax,%eax
je     147a <pkey_rsa_ctrl_str+0x2ea>
lea    0xd5e(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     147a <pkey_rsa_ctrl_str+0x2ea>
lea    0xd4c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     148f <pkey_rsa_ctrl_str+0x2ff>
lea    0xd3a(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1498 <pkey_rsa_ctrl_str+0x308>
mov    0x2c71(%rip),%rax
mov    (%rax),%edi
mov    0x2cd8(%rip),%rax
mov    (%rax),%esi
call   10a0 <RSAerr@plt>
mov    $0xfffffffe,%ebp
jmp    1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2c60(%rip),%r15
movq   $0x0,(%r15)
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    $0xfffffffe,%ebp
cmpb   $0x0,(%rbx)
je     1253 <pkey_rsa_ctrl_str+0xc3>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    1253 <pkey_rsa_ctrl_str+0xc3>
mov    (%r15),%rcx
mov    0x2c44(%rip),%rdx
cmp    (%rdx),%rcx
jne    1391 <pkey_rsa_ctrl_str+0x201>
mov    0x2c20(%rip),%rcx
cmp    (%rcx),%rax
je     1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2c38(%rip),%rcx
cmp    (%rcx),%rax
je     1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2c38(%rip),%rcx
cmp    (%rcx),%rax
jg     1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2c10(%rip),%rcx
cmp    (%rcx),%rax
jl     1253 <pkey_rsa_ctrl_str+0xc3>
mov    %r14,%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <EVP_PKEY_CTX_set_rsa_pss_saltlen@plt>
mov    0x2bc4(%rip),%r15
movq   $0x0,(%r15)
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    $0xfffffffe,%ebp
cmpb   $0x0,(%rbx)
je     1253 <pkey_rsa_ctrl_str+0xc3>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    1253 <pkey_rsa_ctrl_str+0xc3>
mov    (%r15),%rcx
mov    0x2ba8(%rip),%rdx
cmp    (%rdx),%rcx
jne    142d <pkey_rsa_ctrl_str+0x29d>
mov    0x2b84(%rip),%rcx
cmp    (%rcx),%rax
je     1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2b9c(%rip),%rcx
cmp    (%rcx),%rax
je     1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2b9c(%rip),%rcx
cmp    (%rcx),%rax
jg     1253 <pkey_rsa_ctrl_str+0xc3>
mov    0x2b74(%rip),%rcx
cmp    (%rcx),%rax
jl     1253 <pkey_rsa_ctrl_str+0xc3>
mov    %r14,%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <EVP_PKEY_CTX_set_rsa_keygen_bits@plt>
mov    0x2b08(%rip),%rbp
jmp    147a <pkey_rsa_ctrl_str+0x2ea>
mov    0x2b2f(%rip),%rbp
jmp    147a <pkey_rsa_ctrl_str+0x2ea>
mov    0x2b5e(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    0x2b4a(%rip),%rbp
jmp    147a <pkey_rsa_ctrl_str+0x2ea>
mov    0x2ac9(%rip),%rbp
jmp    147a <pkey_rsa_ctrl_str+0x2ea>

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

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"
@errno = global i64 0
@ERANGE = global i64 0
@LONG_MAX = global i64 0
@LONG_MIN = global i64 0
@INT_MAX = global i64 0
@INT_MIN = global i64 0
@.str.9 = [16 x i8] c"rsa_keygen_bits\00"
@.str.10 = [18 x i8] c"rsa_keygen_pubexp\00"
define i32 @pkey_rsa_ctrl_str(i32* %0, i8* nocapture %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = bitcast i8** %4 to i8*
%7 = icmp eq i8* %2, null
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%10 = load i32, i32* @RSA_R_VALUE_MISSING
%11 = tail call i32 @RSAerr(i32 %9, i32 %10)
br label %126
12: ; preds = %3
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %44
15: ; preds = %12
%16 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %40, label %18
18: ; preds = %15
%19 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %40, label %21
21: ; preds = %18
%22 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %40, label %24
24: ; preds = %21
%25 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %40, label %27
27: ; preds = %24
%28 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
br i1 %29, label %40, label %30
30: ; preds = %27
%31 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
br i1 %32, label %40, label %33
33: ; preds = %30
%34 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %33
%37 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%38 = load i32, i32* @RSA_R_UNKNOWN_PADDING_TYPE
%39 = tail call i32 @RSAerr(i32 %37, i32 %38)
br label %126
40: ; preds = %33, %30, %27, %24, %21, %18, %15
%41 = phi i32* [ @RSA_PKCS1_PADDING, %15 ], [ @RSA_SSLV23_PADDING, %18 ], [ @RSA_NO_PADDING, %21 ], [ @RSA_PKCS1_OAEP_PADDING, %24 ], [ @RSA_PKCS1_OAEP_PADDING, %27 ], [ @RSA_X931_PADDING, %30 ], [ @RSA_PKCS1_PSS_PADDING, %33 ]
%42 = load i32, i32* %41
%43 = tail call i32 @EVP_PKEY_CTX_set_rsa_padding(i32* %0, i32 %42)
br label %126
44: ; preds = %12
%45 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %77
47: ; preds = %44
store i64 0, i64* @errno
%48 = call i64 @strtol(i8* %2, i8** %4, i32 10)
%49 = load i8, i8* %2
%50 = icmp eq i8 %49, 0
br i1 %50, label %126, label %51
51: ; preds = %47
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = icmp eq i8 %53, 0
br i1 %54, label %55, label %126
55: ; preds = %51
%56 = load i64, i64* @errno
%57 = load i64, i64* @ERANGE
%58 = icmp eq i64 %56, %57
br i1 %58, label %59, label %68
59: ; preds = %55
%60 = load i64, i64* @LONG_MAX
%61 = icmp eq i64 %48, %60
%62 = load i64, i64* @LONG_MIN
%63 = icmp eq i64 %48, %62
%64 = select i1 %61, i1 true, i1 %63
%65 = load i64, i64* @INT_MAX
%66 = icmp sgt i64 %48, %65
%67 = select i1 %64, i1 true, i1 %66
br i1 %67, label %126, label %71
68: ; preds = %55
%69 = load i64, i64* @INT_MAX
%70 = icmp sgt i64 %48, %69
br i1 %70, label %126, label %71
71: ; preds = %59, %68
%72 = load i64, i64* @INT_MIN
%73 = icmp slt i64 %48, %72
br i1 %73, label %126, label %74
74: ; preds = %71
%75 = trunc i64 %48 to i32
%76 = tail call i32 @EVP_PKEY_CTX_set_rsa_pss_saltlen(i32* %0, i32 %75)
br label %126
77: ; preds = %44
%78 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %110
80: ; preds = %77
store i64 0, i64* @errno
%81 = call i64 @strtol(i8* %2, i8** %4, i32 10)
%82 = load i8, i8* %2
%83 = icmp eq i8 %82, 0
br i1 %83, label %126, label %84
84: ; preds = %80
%85 = load i8*, i8** %4
%86 = load i8, i8* %85
%87 = icmp eq i8 %86, 0
br i1 %87, label %88, label %126
88: ; preds = %84
%89 = load i64, i64* @errno
%90 = load i64, i64* @ERANGE
%91 = icmp eq i64 %89, %90
br i1 %91, label %92, label %101
92: ; preds = %88
%93 = load i64, i64* @LONG_MAX
%94 = icmp eq i64 %81, %93
%95 = load i64, i64* @LONG_MIN
%96 = icmp eq i64 %81, %95
%97 = select i1 %94, i1 true, i1 %96
%98 = load i64, i64* @INT_MAX
%99 = icmp sgt i64 %81, %98
%100 = select i1 %97, i1 true, i1 %99
br i1 %100, label %126, label %104
101: ; preds = %88
%102 = load i64, i64* @INT_MAX
%103 = icmp sgt i64 %81, %102
br i1 %103, label %126, label %104
104: ; preds = %92, %101
%105 = load i64, i64* @INT_MIN
%106 = icmp slt i64 %81, %105
br i1 %106, label %126, label %107
107: ; preds = %104
%108 = trunc i64 %81 to i32
%109 = tail call i32 @EVP_PKEY_CTX_set_rsa_keygen_bits(i32* %0, i32 %108)
br label %126
110: ; preds = %77
%111 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(18) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %126
113: ; preds = %110
%114 = bitcast i32** %5 to i8*
store i32* null, i32** %5
%115 = call i32 @BN_asc2bn(i32** %5, i8* %2)
%116 = icmp eq i32 %115, 0
br i1 %116, label %124, label %117
117: ; preds = %113
%118 = load i32*, i32** %5
%119 = call i32 @EVP_PKEY_CTX_set_rsa_keygen_pubexp(i32* %0, i32* %118)
%120 = icmp slt i32 %119, 1
br i1 %120, label %121, label %124
121: ; preds = %117
%122 = load i32*, i32** %5
%123 = call i32 @BN_free(i32* %122)
br label %124
124: ; preds = %117, %121, %113
%125 = phi i32 [ 0, %113 ], [ %119, %121 ], [ %119, %117 ]
br label %126
126: ; preds = %92, %101, %104, %80, %84, %59, %68, %71, %47, %51, %110, %107, %74, %36, %40, %124, %8
%127 = phi i32 [ %125, %124 ], [ %109, %107 ], [ %76, %74 ], [ 0, %8 ], [ -2, %36 ], [ %43, %40 ], [ -2, %110 ], [ -2, %51 ], [ -2, %47 ], [ -2, %71 ], [ -2, %68 ], [ -2, %59 ], [ -2, %84 ], [ -2, %80 ], [ -2, %104 ], [ -2, %101 ], [ -2, %92 ]
ret i32 %127
}