#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 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_X931_PADDING;
int /*<<< orphan*/ RSAerror(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) {
    RSAerror(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, "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 {
      RSAerror(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    11c9 <pkey_rsa_ctrl_str+0x39>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1090 <RSAerror@plt>
movl   $0x0,-0x4(%rbp)
jmp    157f <pkey_rsa_ctrl_str+0x3ef>
mov    -0x18(%rbp),%rdi
lea    0xe2c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1325 <pkey_rsa_ctrl_str+0x195>
mov    -0x20(%rbp),%rdi
lea    0xe24(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    120c <pkey_rsa_ctrl_str+0x7c>
mov    0x2d7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1311 <pkey_rsa_ctrl_str+0x181>
mov    -0x20(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1236 <pkey_rsa_ctrl_str+0xa6>
mov    0x2dac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    130c <pkey_rsa_ctrl_str+0x17c>
mov    -0x20(%rbp),%rdi
lea    0xddb(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1260 <pkey_rsa_ctrl_str+0xd0>
mov    0x2d72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1307 <pkey_rsa_ctrl_str+0x177>
mov    -0x20(%rbp),%rdi
lea    0xdb6(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    128a <pkey_rsa_ctrl_str+0xfa>
mov    0x2d48(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1302 <pkey_rsa_ctrl_str+0x172>
mov    -0x20(%rbp),%rdi
lea    0xd91(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12b4 <pkey_rsa_ctrl_str+0x124>
mov    0x2d36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    12fd <pkey_rsa_ctrl_str+0x16d>
mov    -0x20(%rbp),%rdi
lea    0xd6c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12de <pkey_rsa_ctrl_str+0x14e>
mov    0x2ca4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    12f8 <pkey_rsa_ctrl_str+0x168>
mov    0x2d0b(%rip),%rax
mov    (%rax),%edi
call   1090 <RSAerror@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    157f <pkey_rsa_ctrl_str+0x3ef>
jmp    12fd <pkey_rsa_ctrl_str+0x16d>
jmp    1302 <pkey_rsa_ctrl_str+0x172>
jmp    1307 <pkey_rsa_ctrl_str+0x177>
jmp    130c <pkey_rsa_ctrl_str+0x17c>
jmp    1311 <pkey_rsa_ctrl_str+0x181>
mov    -0x10(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   10a0 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    %eax,-0x4(%rbp)
jmp    157f <pkey_rsa_ctrl_str+0x3ef>
mov    -0x18(%rbp),%rdi
lea    0xcff(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1411 <pkey_rsa_ctrl_str+0x281>
mov    0x2c53(%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     1382 <pkey_rsa_ctrl_str+0x1f2>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1387 <pkey_rsa_ctrl_str+0x1f7>
jmp    1573 <pkey_rsa_ctrl_str+0x3e3>
mov    0x2c0a(%rip),%rax
mov    (%rax),%rax
mov    0x2c18(%rip),%rcx
cmp    (%rcx),%rax
jne    13c9 <pkey_rsa_ctrl_str+0x239>
mov    -0x28(%rbp),%rax
mov    0x2bf4(%rip),%rcx
cmp    (%rcx),%rax
je     13f1 <pkey_rsa_ctrl_str+0x261>
mov    -0x28(%rbp),%rax
mov    0x2c00(%rip),%rcx
cmp    (%rcx),%rax
je     13f1 <pkey_rsa_ctrl_str+0x261>
mov    -0x28(%rbp),%rax
mov    0x2bfc(%rip),%rcx
cmp    (%rcx),%rax
jg     13f1 <pkey_rsa_ctrl_str+0x261>
mov    -0x28(%rbp),%rax
mov    0x2bd0(%rip),%rcx
cmp    (%rcx),%rax
jge    13f6 <pkey_rsa_ctrl_str+0x266>
jmp    1578 <pkey_rsa_ctrl_str+0x3e8>
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    157f <pkey_rsa_ctrl_str+0x3ef>
mov    -0x18(%rbp),%rdi
lea    0xc23(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    14fd <pkey_rsa_ctrl_str+0x36d>
mov    0x2b67(%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     146e <pkey_rsa_ctrl_str+0x2de>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1473 <pkey_rsa_ctrl_str+0x2e3>
jmp    1573 <pkey_rsa_ctrl_str+0x3e3>
mov    0x2b1e(%rip),%rax
mov    (%rax),%rax
mov    0x2b2c(%rip),%rcx
cmp    (%rcx),%rax
jne    14b5 <pkey_rsa_ctrl_str+0x325>
mov    -0x28(%rbp),%rax
mov    0x2b08(%rip),%rcx
cmp    (%rcx),%rax
je     14dd <pkey_rsa_ctrl_str+0x34d>
mov    -0x28(%rbp),%rax
mov    0x2b14(%rip),%rcx
cmp    (%rcx),%rax
je     14dd <pkey_rsa_ctrl_str+0x34d>
mov    -0x28(%rbp),%rax
mov    0x2b10(%rip),%rcx
cmp    (%rcx),%rax
jg     14dd <pkey_rsa_ctrl_str+0x34d>
mov    -0x28(%rbp),%rax
mov    0x2ae4(%rip),%rcx
cmp    (%rcx),%rax
jge    14e2 <pkey_rsa_ctrl_str+0x352>
jmp    1578 <pkey_rsa_ctrl_str+0x3e8>
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    157f <pkey_rsa_ctrl_str+0x3ef>
mov    -0x18(%rbp),%rdi
lea    0xb47(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    156e <pkey_rsa_ctrl_str+0x3de>
movq   $0x0,-0x48(%rbp)
mov    -0x20(%rbp),%rsi
lea    -0x48(%rbp),%rdi
call   1030 <BN_asc2bn@plt>
cmp    $0x0,%eax
jne    1540 <pkey_rsa_ctrl_str+0x3b0>
movl   $0x0,-0x4(%rbp)
jmp    157f <pkey_rsa_ctrl_str+0x3ef>
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     1563 <pkey_rsa_ctrl_str+0x3d3>
mov    -0x48(%rbp),%rdi
call   1040 <BN_free@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    157f <pkey_rsa_ctrl_str+0x3ef>
jmp    1573 <pkey_rsa_ctrl_str+0x3e3>
jmp    1578 <pkey_rsa_ctrl_str+0x3e8>
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     1257 <pkey_rsa_ctrl_str+0xc7>
lea    0xe68(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1300 <pkey_rsa_ctrl_str+0x170>
lea    0xe61(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     139c <pkey_rsa_ctrl_str+0x20c>
lea    0xe5a(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
mov    $0xfffffffe,%ebp
test   %eax,%eax
jne    124a <pkey_rsa_ctrl_str+0xba>
movq   $0x0,(%rsp)
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <BN_asc2bn@plt>
test   %eax,%eax
je     1248 <pkey_rsa_ctrl_str+0xb8>
mov    (%rsp),%rsi
mov    %r14,%rdi
call   1080 <EVP_PKEY_CTX_set_rsa_keygen_pubexp@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     124a <pkey_rsa_ctrl_str+0xba>
mov    (%rsp),%rdi
call   1040 <BN_free@plt>
jmp    124a <pkey_rsa_ctrl_str+0xba>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
call   1090 <RSAerror@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdb3(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1438 <pkey_rsa_ctrl_str+0x2a8>
lea    0xda2(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1441 <pkey_rsa_ctrl_str+0x2b1>
lea    0xd90(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    0x2d2d(%rip),%rbp
test   %eax,%eax
je     1448 <pkey_rsa_ctrl_str+0x2b8>
lea    0xd77(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1448 <pkey_rsa_ctrl_str+0x2b8>
lea    0xd65(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     145d <pkey_rsa_ctrl_str+0x2cd>
lea    0xd53(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1466 <pkey_rsa_ctrl_str+0x2d6>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   1090 <RSAerror@plt>
mov    $0xfffffffe,%ebp
jmp    124a <pkey_rsa_ctrl_str+0xba>
mov    0x2c91(%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     124a <pkey_rsa_ctrl_str+0xba>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    124a <pkey_rsa_ctrl_str+0xba>
mov    (%r15),%rcx
mov    0x2c6d(%rip),%rdx
cmp    (%rdx),%rcx
jne    1368 <pkey_rsa_ctrl_str+0x1d8>
mov    0x2c51(%rip),%rcx
cmp    (%rcx),%rax
je     124a <pkey_rsa_ctrl_str+0xba>
mov    0x2c61(%rip),%rcx
cmp    (%rcx),%rax
je     124a <pkey_rsa_ctrl_str+0xba>
mov    0x2c61(%rip),%rcx
cmp    (%rcx),%rax
jg     124a <pkey_rsa_ctrl_str+0xba>
mov    0x2c39(%rip),%rcx
cmp    (%rcx),%rax
jl     124a <pkey_rsa_ctrl_str+0xba>
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    0x2bf5(%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     124a <pkey_rsa_ctrl_str+0xba>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    124a <pkey_rsa_ctrl_str+0xba>
mov    (%r15),%rcx
mov    0x2bd1(%rip),%rdx
cmp    (%rdx),%rcx
jne    1404 <pkey_rsa_ctrl_str+0x274>
mov    0x2bb5(%rip),%rcx
cmp    (%rcx),%rax
je     124a <pkey_rsa_ctrl_str+0xba>
mov    0x2bc5(%rip),%rcx
cmp    (%rcx),%rax
je     124a <pkey_rsa_ctrl_str+0xba>
mov    0x2bc5(%rip),%rcx
cmp    (%rcx),%rax
jg     124a <pkey_rsa_ctrl_str+0xba>
mov    0x2b9d(%rip),%rcx
cmp    (%rcx),%rax
jl     124a <pkey_rsa_ctrl_str+0xba>
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    0x2b41(%rip),%rbp
jmp    1448 <pkey_rsa_ctrl_str+0x2b8>
mov    0x2b90(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    0x2b7c(%rip),%rbp
jmp    1448 <pkey_rsa_ctrl_str+0x2b8>
mov    0x2b0b(%rip),%rbp
jmp    1448 <pkey_rsa_ctrl_str+0x2b8>

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

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