#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*/ *);
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);
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*/);
int atoi(char const *);
int /*<<< orphan*/ 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")) {
    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;
    saltlen = atoi(value);
    return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen);
  }
  if (!strcmp(type, "rsa_keygen_bits")) {
    int nbits;
    nbits = atoi(value);
    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;
  }
  return -2;
}


x86 assembly (clang, -O0):
<pkey_rsa_ctrl_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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    0x2dfa(%rip),%rax
mov    (%rax),%edi
mov    0x2df9(%rip),%rax
mov    (%rax),%esi
call   1090 <RSAerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    1450 <pkey_rsa_ctrl_str+0x2c0>
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    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%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    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%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,-0x24(%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    0x2d47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%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    0x2d1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%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,-0x24(%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    0x2c91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
jmp    1334 <pkey_rsa_ctrl_str+0x1a4>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
mov    0x2ccf(%rip),%rax
mov    (%rax),%esi
call   1090 <RSAerr@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1450 <pkey_rsa_ctrl_str+0x2c0>
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    -0x24(%rbp),%esi
call   1080 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    %eax,-0x4(%rbp)
jmp    1450 <pkey_rsa_ctrl_str+0x2c0>
mov    -0x18(%rbp),%rdi
lea    0xcc5(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    139f <pkey_rsa_ctrl_str+0x20f>
mov    -0x20(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   10b0 <EVP_PKEY_CTX_set_rsa_pss_saltlen@plt>
mov    %eax,-0x4(%rbp)
jmp    1450 <pkey_rsa_ctrl_str+0x2c0>
mov    -0x18(%rbp),%rdi
lea    0xc9c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    13d8 <pkey_rsa_ctrl_str+0x248>
mov    -0x20(%rbp),%rdi
call   10a0 <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    1450 <pkey_rsa_ctrl_str+0x2c0>
mov    -0x18(%rbp),%rdi
lea    0xc73(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1449 <pkey_rsa_ctrl_str+0x2b9>
movq   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rsi
lea    -0x38(%rbp),%rdi
call   1030 <BN_asc2bn@plt>
cmp    $0x0,%eax
jne    141b <pkey_rsa_ctrl_str+0x28b>
movl   $0x0,-0x4(%rbp)
jmp    1450 <pkey_rsa_ctrl_str+0x2c0>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1070 <EVP_PKEY_CTX_set_rsa_keygen_pubexp@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jg     143e <pkey_rsa_ctrl_str+0x2ae>
mov    -0x38(%rbp),%rdi
call   1040 <BN_free@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1450 <pkey_rsa_ctrl_str+0x2c0>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%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     1241 <pkey_rsa_ctrl_str+0xb1>
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1266 <pkey_rsa_ctrl_str+0xd6>
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     132f <pkey_rsa_ctrl_str+0x19f>
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     134a <pkey_rsa_ctrl_str+0x1ba>
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0xfffffffe,%ebx
test   %eax,%eax
jne    125a <pkey_rsa_ctrl_str+0xca>
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    %r15,%rsi
call   1030 <BN_asc2bn@plt>
test   %eax,%eax
je     1258 <pkey_rsa_ctrl_str+0xc8>
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1070 <EVP_PKEY_CTX_set_rsa_keygen_pubexp@plt>
mov    %eax,%ebx
test   %eax,%eax
jg     125a <pkey_rsa_ctrl_str+0xca>
mov    0x8(%rsp),%rdi
call   1040 <BN_free@plt>
jmp    125a <pkey_rsa_ctrl_str+0xca>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
mov    0x2d67(%rip),%rax
mov    (%rax),%esi
call   1090 <RSAerr@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xda4(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1365 <pkey_rsa_ctrl_str+0x1d5>
lea    0xd93(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     136e <pkey_rsa_ctrl_str+0x1de>
lea    0xd83(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1377 <pkey_rsa_ctrl_str+0x1e7>
lea    0xd71(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
mov    0x2d0f(%rip),%rbx
test   %eax,%eax
je     137e <pkey_rsa_ctrl_str+0x1ee>
lea    0xd58(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     137e <pkey_rsa_ctrl_str+0x1ee>
lea    0xd46(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1391 <pkey_rsa_ctrl_str+0x201>
lea    0xd34(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     139a <pkey_rsa_ctrl_str+0x20a>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
mov    0x2cd2(%rip),%rax
mov    (%rax),%esi
call   1090 <RSAerr@plt>
mov    $0xfffffffe,%ebx
jmp    125a <pkey_rsa_ctrl_str+0xca>
mov    %r15,%rdi
call   10a0 <atoi@plt>
mov    %r14,%rdi
mov    %eax,%esi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    10b0 <EVP_PKEY_CTX_set_rsa_pss_saltlen@plt>
mov    %r15,%rdi
call   10a0 <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    0x2c34(%rip),%rbx
jmp    137e <pkey_rsa_ctrl_str+0x1ee>
mov    0x2c4b(%rip),%rbx
jmp    137e <pkey_rsa_ctrl_str+0x1ee>
mov    0x2c5a(%rip),%rbx
mov    (%rbx),%esi
mov    %r14,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1080 <EVP_PKEY_CTX_set_rsa_padding@plt>
mov    0x2c48(%rip),%rbx
jmp    137e <pkey_rsa_ctrl_str+0x1ee>
mov    0x2bf7(%rip),%rbx
jmp    137e <pkey_rsa_ctrl_str+0x1ee>

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

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"
define i32 @pkey_rsa_ctrl_str(i32* %0, i8* nocapture %1, i8* %2) {
%4 = alloca i32*
%5 = icmp eq i8* %2, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%8 = load i32, i32* @RSA_R_VALUE_MISSING
%9 = tail call i32 @RSAerr(i32 %7, i32 %8)
br label %70
10: ; preds = %3
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %42
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %38, label %16
16: ; preds = %13
%17 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %38, label %19
19: ; preds = %16
%20 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %38, label %22
22: ; preds = %19
%23 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %38, label %25
25: ; preds = %22
%26 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %38, label %28
28: ; preds = %25
%29 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %38, label %31
31: ; preds = %28
%32 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %31
%35 = load i32, i32* @RSA_F_PKEY_RSA_CTRL_STR
%36 = load i32, i32* @RSA_R_UNKNOWN_PADDING_TYPE
%37 = tail call i32 @RSAerr(i32 %35, i32 %36)
br label %70
38: ; preds = %31, %28, %25, %22, %19, %16, %13
%39 = phi i32* [ @RSA_PKCS1_PADDING, %13 ], [ @RSA_SSLV23_PADDING, %16 ], [ @RSA_NO_PADDING, %19 ], [ @RSA_PKCS1_OAEP_PADDING, %22 ], [ @RSA_PKCS1_OAEP_PADDING, %25 ], [ @RSA_X931_PADDING, %28 ], [ @RSA_PKCS1_PSS_PADDING, %31 ]
%40 = load i32, i32* %39
%41 = tail call i32 @EVP_PKEY_CTX_set_rsa_padding(i32* %0, i32 %40)
br label %70
42: ; preds = %10
%43 = 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))
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = tail call i32 @atoi(i8* %2)
%47 = tail call i32 @EVP_PKEY_CTX_set_rsa_pss_saltlen(i32* %0, i32 %46)
br label %70
48: ; preds = %42
%49 = 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))
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = tail call i32 @atoi(i8* %2)
%53 = tail call i32 @EVP_PKEY_CTX_set_rsa_keygen_bits(i32* %0, i32 %52)
br label %70
54: ; preds = %48
%55 = 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))
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %70
57: ; preds = %54
%58 = bitcast i32** %4 to i8*
store i32* null, i32** %4
%59 = call i32 @BN_asc2bn(i32** %4, i8* %2)
%60 = icmp eq i32 %59, 0
br i1 %60, label %68, label %61
61: ; preds = %57
%62 = load i32*, i32** %4
%63 = call i32 @EVP_PKEY_CTX_set_rsa_keygen_pubexp(i32* %0, i32* %62)
%64 = icmp slt i32 %63, 1
br i1 %64, label %65, label %68
65: ; preds = %61
%66 = load i32*, i32** %4
%67 = call i32 @BN_free(i32* %66)
br label %68
68: ; preds = %61, %65, %57
%69 = phi i32 [ 0, %57 ], [ %63, %65 ], [ %63, %61 ]
br label %70
70: ; preds = %54, %34, %38, %68, %51, %45, %6
%71 = phi i32 [ %69, %68 ], [ %53, %51 ], [ %47, %45 ], [ 0, %6 ], [ -2, %34 ], [ %41, %38 ], [ -2, %54 ]
ret i32 %71
}