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

/* Variables and functions */
int /*<<< orphan*/ *BN_bin2bn(unsigned char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ EC_KEY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EC_KEY_new_by_curve_name(int);
int /*<<< orphan*/ EC_KEY_set_public_key_affine_coordinates(
    int /*<<< orphan*/ *, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ EVP_PKEY_assign_EC_KEY(int /*<<< orphan*/ *,
                                          int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_new();
int NID_X9_62_prime256v1;
int NID_secp384r1;
int NID_secp521r1;
scalar_t__ sc_base64_decode(char *, unsigned char *, int);
scalar_t__ strncmp(char *, char *, int);
EVP_PKEY *ssh_nistp_line_to_key(char *line) {
  EVP_PKEY *key;
  EC_KEY *ec_key;
  BIGNUM *x;
  BIGNUM *y;
  unsigned char decoded[16384];
  int len;
  int flen;
  char *b, *c;
  int i;
  int nid;
  if (strncmp(line + 16, "256", 3) == 0)
    flen = 32, nid = NID_X9_62_prime256v1;
  else if (strncmp(line + 16, "384", 3) == 0)
    flen = 48, nid = NID_secp384r1;
  else if (strncmp(line + 16, "521", 3) == 0)
    flen = 66, nid = NID_secp521r1;
  else
    return NULL;
  b = line;
  if (!b)
    return NULL;
  while (*b && *b != ' ')
    b++;
  b++;
  for (c = b; *c && *c != ' ' && 'c' != '\t' && *c != '\r' && *c != '\n'; c++)
    ;
  *c = 0;
  if (sc_base64_decode(b, decoded, 16384) < 0)
    return NULL;
  i = 0;
  len = (decoded[i] << 24) + (decoded[i + 1] << 16) + (decoded[i + 2] << 8) +
        (decoded[i + 3]);
  i += 4;
  if (len != 19)
    return NULL;
  if (strncmp((char *)&decoded[i], line, 19) != 0)
    return NULL;
  i += len;
  len = (decoded[i] << 24) + (decoded[i + 1] << 16) + (decoded[i + 2] << 8) +
        (decoded[i + 3]);
  i += 4;
  if (len != 8)
    return NULL;
  if (strncmp((char *)&decoded[i], line + 11, 8) != 0)
    return NULL;
  i += len;
  len = (decoded[i] << 24) + (decoded[i + 1] << 16) + (decoded[i + 2] << 8) +
        (decoded[i + 3]);
  i += 4;
  if (len != 1 + flen * 2)
    return NULL;
  if (decoded[i] != 4)
    return NULL;
  i++;
  ec_key = EC_KEY_new_by_curve_name(nid);
  x = BN_bin2bn(decoded + i, flen, NULL);
  i += flen;
  y = BN_bin2bn(decoded + i, flen, NULL);
  if (!EC_KEY_set_public_key_affine_coordinates(ec_key, x, y)) {
    EC_KEY_free(ec_key);
    BN_free(x);
    BN_free(y);
    return NULL;
  }
  key = EVP_PKEY_new();
  EVP_PKEY_assign_EC_KEY(key, ec_key);
  return key;
}


x86 assembly (clang, -O0):
<ssh_nistp_line_to_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4060,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
lea    0xe52(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11e0 <ssh_nistp_line_to_key+0x50>
movl   $0x20,-0x4038(%rbp)
mov    0x2e05(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4050(%rbp)
jmp    1279 <ssh_nistp_line_to_key+0xe9>
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
lea    0xe15(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1221 <ssh_nistp_line_to_key+0x91>
movl   $0x30,-0x4038(%rbp)
mov    0x2dd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4050(%rbp)
jmp    1274 <ssh_nistp_line_to_key+0xe4>
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
lea    0xdd8(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1262 <ssh_nistp_line_to_key+0xd2>
movl   $0x42,-0x4038(%rbp)
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4050(%rbp)
jmp    126f <ssh_nistp_line_to_key+0xdf>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
jmp    1274 <ssh_nistp_line_to_key+0xe4>
jmp    1279 <ssh_nistp_line_to_key+0xe9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x4040(%rbp)
cmpq   $0x0,-0x4040(%rbp)
jne    129f <ssh_nistp_line_to_key+0x10f>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
jmp    12a4 <ssh_nistp_line_to_key+0x114>
mov    -0x4040(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x4051(%rbp)
je     12d5 <ssh_nistp_line_to_key+0x145>
mov    -0x4040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x4051(%rbp)
mov    -0x4051(%rbp),%al
test   $0x1,%al
jne    12e8 <ssh_nistp_line_to_key+0x158>
jmp    12ff <ssh_nistp_line_to_key+0x16f>
mov    -0x4040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4040(%rbp)
jmp    12a4 <ssh_nistp_line_to_key+0x114>
mov    -0x4040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4040(%rbp)
mov    -0x4040(%rbp),%rax
mov    %rax,-0x4048(%rbp)
mov    -0x4048(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x4052(%rbp)
je     1386 <ssh_nistp_line_to_key+0x1f6>
mov    -0x4048(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x4052(%rbp)
je     1386 <ssh_nistp_line_to_key+0x1f6>
mov    -0x4048(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x4052(%rbp)
je     1386 <ssh_nistp_line_to_key+0x1f6>
mov    -0x4048(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x4052(%rbp)
mov    -0x4052(%rbp),%al
test   $0x1,%al
jne    1399 <ssh_nistp_line_to_key+0x209>
jmp    13b5 <ssh_nistp_line_to_key+0x225>
jmp    139e <ssh_nistp_line_to_key+0x20e>
mov    -0x4048(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4048(%rbp)
jmp    131f <ssh_nistp_line_to_key+0x18f>
mov    -0x4048(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4040(%rbp),%rdi
lea    -0x4030(%rbp),%rsi
mov    $0x4000,%edx
call   1040 <sc_base64_decode@plt>
cmp    $0x0,%rax
jge    13ee <ssh_nistp_line_to_key+0x25e>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
movl   $0x0,-0x404c(%rbp)
movslq -0x404c(%rbp),%rax
movzbl -0x4030(%rbp,%rax,1),%eax
ff
shl    $0x18,%eax
mov    -0x404c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x404c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x404c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
add    %ecx,%eax
mov    %eax,-0x4034(%rbp)
mov    -0x404c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x404c(%rbp)
cmpl   $0x13,-0x4034(%rbp)
je     1481 <ssh_nistp_line_to_key+0x2f1>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
movslq -0x404c(%rbp),%rax
lea    -0x4030(%rbp),%rdi
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x13,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     14b7 <ssh_nistp_line_to_key+0x327>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
mov    -0x4034(%rbp),%eax
add    -0x404c(%rbp),%eax
mov    %eax,-0x404c(%rbp)
movslq -0x404c(%rbp),%rax
movzbl -0x4030(%rbp,%rax,1),%eax
ff
shl    $0x18,%eax
mov    -0x404c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x404c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x404c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
add    %ecx,%eax
mov    %eax,-0x4034(%rbp)
mov    -0x404c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x404c(%rbp)
cmpl   $0x8,-0x4034(%rbp)
je     1552 <ssh_nistp_line_to_key+0x3c2>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
movslq -0x404c(%rbp),%rax
lea    -0x4030(%rbp),%rdi
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
add    $0xb,%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     158c <ssh_nistp_line_to_key+0x3fc>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
mov    -0x4034(%rbp),%eax
add    -0x404c(%rbp),%eax
mov    %eax,-0x404c(%rbp)
movslq -0x404c(%rbp),%rax
movzbl -0x4030(%rbp,%rax,1),%eax
ff
shl    $0x18,%eax
mov    -0x404c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x404c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x404c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movzbl -0x4030(%rbp,%rcx,1),%ecx
ff
add    %ecx,%eax
mov    %eax,-0x4034(%rbp)
mov    -0x404c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x404c(%rbp)
mov    -0x4034(%rbp),%eax
mov    -0x4038(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     1634 <ssh_nistp_line_to_key+0x4a4>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
movslq -0x404c(%rbp),%rax
movzbl -0x4030(%rbp,%rax,1),%eax
ff
cmp    $0x4,%eax
je     1659 <ssh_nistp_line_to_key+0x4c9>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
mov    -0x404c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404c(%rbp)
mov    -0x4050(%rbp),%edi
call   10b0 <EC_KEY_new_by_curve_name@plt>
mov    %rax,-0x20(%rbp)
lea    -0x4030(%rbp),%rdi
movslq -0x404c(%rbp),%rax
add    %rax,%rdi
mov    -0x4038(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <BN_bin2bn@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4038(%rbp),%eax
add    -0x404c(%rbp),%eax
mov    %eax,-0x404c(%rbp)
lea    -0x4030(%rbp),%rdi
movslq -0x404c(%rbp),%rax
add    %rax,%rdi
mov    -0x4038(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <BN_bin2bn@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <EC_KEY_set_public_key_affine_coordinates@plt>
cmp    $0x0,%eax
jne    1713 <ssh_nistp_line_to_key+0x583>
mov    -0x20(%rbp),%rdi
call   1090 <EC_KEY_free@plt>
mov    -0x28(%rbp),%rdi
call   1070 <BN_free@plt>
mov    -0x30(%rbp),%rdi
call   1070 <BN_free@plt>
movq   $0x0,-0x8(%rbp)
jmp    1733 <ssh_nistp_line_to_key+0x5a3>
mov    $0x0,%al
call   1080 <EVP_PKEY_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10a0 <EVP_PKEY_assign_EC_KEY@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4060,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssh_nistp_line_to_key>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x4008,%rsp
mov    %rdi,%rbx
lea    0x10(%rdi),%rbp
lea    0xe55(%rip),%rsi
mov    %rbp,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     120a <ssh_nistp_line_to_key+0x7a>
lea    0xe40(%rip),%rsi
mov    %rbp,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1221 <ssh_nistp_line_to_key+0x91>
lea    0xe2b(%rip),%rsi
mov    %rbp,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12e2 <ssh_nistp_line_to_key+0x152>
mov    0x2dd6(%rip),%rax
mov    $0x42,%r14d
test   %rbx,%rbx
jne    1237 <ssh_nistp_line_to_key+0xa7>
jmp    12e2 <ssh_nistp_line_to_key+0x152>
mov    0x2dc7(%rip),%rax
mov    $0x20,%r14d
test   %rbx,%rbx
jne    1237 <ssh_nistp_line_to_key+0xa7>
jmp    12e2 <ssh_nistp_line_to_key+0x152>
mov    0x2dc0(%rip),%rax
mov    $0x30,%r14d
test   %rbx,%rbx
je     12e2 <ssh_nistp_line_to_key+0x152>
mov    (%rax),%r15d
lea    0x1(%rbx),%rdi
testb  $0xdf,-0x1(%rdi)
je     125a <ssh_nistp_line_to_key+0xca>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rdi
testb  $0xdf,-0x1(%rdi)
jne    1250 <ssh_nistp_line_to_key+0xc0>
movabs $0x100002401,%rcx
mov    %rdi,%rax
jmp    1274 <ssh_nistp_line_to_key+0xe4>
nopl   0x0(%rax)
add    $0x1,%rax
movzbl (%rax),%edx
cmp    $0x20,%rdx
ja     1270 <ssh_nistp_line_to_key+0xe0>
bt     %rdx,%rcx
jae    1270 <ssh_nistp_line_to_key+0xe0>
movb   $0x0,(%rax)
mov    %rsp,%rbp
mov    %rbp,%rsi
mov    $0x4000,%edx
call   1040 <sc_base64_decode@plt>
test   %rax,%rax
js     12e2 <ssh_nistp_line_to_key+0x152>
mov    (%rsp),%eax
bswap  %eax
cmp    $0x13,%eax
jne    12e2 <ssh_nistp_line_to_key+0x152>
lea    0x4(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x13,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12e2 <ssh_nistp_line_to_key+0x152>
mov    0x17(%rsp),%eax
bswap  %eax
cmp    $0x8,%eax
jne    12e2 <ssh_nistp_line_to_key+0x152>
lea    0x1b(%rsp),%rdi
add    $0xb,%rbx
mov    %rbx,%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12f5 <ssh_nistp_line_to_key+0x165>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x4008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x23(%rsp),%eax
bswap  %eax
lea    (%r14,%r14,1),%ecx
add    $0x1,%ecx
xor    %ebx,%ebx
cmp    %ecx,%eax
jne    12e4 <ssh_nistp_line_to_key+0x154>
cmpb   $0x4,0x27(%rsp)
jne    12e4 <ssh_nistp_line_to_key+0x154>
mov    %r15d,%edi
call   10b0 <EC_KEY_new_by_curve_name@plt>
mov    %rax,%r15
lea    0x28(%rsp),%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   1060 <BN_bin2bn@plt>
mov    %rax,%rbx
mov    %r14d,%eax
lea    (%rax,%rbp,1),%rdi
add    $0x28,%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   1060 <BN_bin2bn@plt>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <EC_KEY_set_public_key_affine_coordinates@plt>
test   %eax,%eax
je     1370 <ssh_nistp_line_to_key+0x1e0>
xor    %eax,%eax
call   1080 <EVP_PKEY_new@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   10a0 <EVP_PKEY_assign_EC_KEY@plt>
jmp    12e4 <ssh_nistp_line_to_key+0x154>
mov    %r15,%rdi
call   1090 <EC_KEY_free@plt>
mov    %rbx,%rdi
call   1070 <BN_free@plt>
mov    %rbp,%rdi
call   1070 <BN_free@plt>
jmp    12e2 <ssh_nistp_line_to_key+0x152>

LLVM IR (-O0):
@.str = [4 x i8] c"256\00"
@NID_X9_62_prime256v1 = global i32 0
@.str.1 = [4 x i8] c"384\00"
@NID_secp384r1 = global i32 0
@.str.2 = [4 x i8] c"521\00"
@NID_secp521r1 = global i32 0
define i32* @ssh_nistp_line_to_key(i8* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [16384 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %3
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 16
%17 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %1
store i32 32, i32* %10
%20 = load i32, i32* @NID_X9_62_prime256v1
store i32 %20, i32* %14
br label %38
21: ; preds = %1
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 16
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %21
store i32 48, i32* %10
%27 = load i32, i32* @NID_secp384r1
store i32 %27, i32* %14
br label %37
28: ; preds = %21
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 16
%31 = call i64 @strncmp(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
store i32 66, i32* %10
%34 = load i32, i32* @NID_secp521r1
store i32 %34, i32* %14
br label %36
35: ; preds = %28
store i32* null, i32** %2
br label %273
36: ; preds = %33
br label %37
37: ; preds = %36, %26
br label %38
38: ; preds = %37, %19
%39 = load i8*, i8** %3
store i8* %39, i8** %11
%40 = load i8*, i8** %11
%41 = icmp ne i8* %40, null
br i1 %41, label %43, label %42
42: ; preds = %38
store i32* null, i32** %2
br label %273
43: ; preds = %38
br label %44
44: ; preds = %56, %43
%45 = load i8*, i8** %11
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %44
%50 = load i8*, i8** %11
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 32
br label %54
54: ; preds = %49, %44
%55 = phi i1 [ false, %44 ], [ %53, %49 ]
br i1 %55, label %56, label %59
56: ; preds = %54
%57 = load i8*, i8** %11
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %11
br label %44
59: ; preds = %54
%60 = load i8*, i8** %11
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %11
%62 = load i8*, i8** %11
store i8* %62, i8** %12
br label %63
63: ; preds = %86, %59
%64 = load i8*, i8** %12
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %83
68: ; preds = %63
%69 = load i8*, i8** %12
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %71, 32
br i1 %72, label %73, label %83
73: ; preds = %68
%74 = load i8*, i8** %12
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp ne i32 %76, 13
br i1 %77, label %78, label %83
78: ; preds = %73
%79 = load i8*, i8** %12
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp ne i32 %81, 10
br label %83
83: ; preds = %78, %73, %68, %63
%84 = phi i1 [ false, %73 ], [ false, %68 ], [ false, %63 ], [ %82, %78 ]
br i1 %84, label %85, label %89
85: ; preds = %83
br label %86
86: ; preds = %85
%87 = load i8*, i8** %12
%88 = getelementptr inbounds i8, i8* %87, i32 1
store i8* %88, i8** %12
br label %63
89: ; preds = %83
%90 = load i8*, i8** %12
store i8 0, i8* %90
%91 = load i8*, i8** %11
%92 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 0
%93 = call i64 @sc_base64_decode(i8* %91, i8* %92, i32 16384)
%94 = icmp slt i64 %93, 0
br i1 %94, label %95, label %96
95: ; preds = %89
store i32* null, i32** %2
br label %273
96: ; preds = %89
store i32 0, i32* %13
%97 = load i32, i32* %13
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %98
%100 = load i8, i8* %99
%101 = zext i8 %100 to i32
%102 = shl i32 %101, 24
%103 = load i32, i32* %13
%104 = add nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %105
%107 = load i8, i8* %106
%108 = zext i8 %107 to i32
%109 = shl i32 %108, 16
%110 = add nsw i32 %102, %109
%111 = load i32, i32* %13
%112 = add nsw i32 %111, 2
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %113
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = shl i32 %116, 8
%118 = add nsw i32 %110, %117
%119 = load i32, i32* %13
%120 = add nsw i32 %119, 3
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %121
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = add nsw i32 %118, %124
store i32 %125, i32* %9
%126 = load i32, i32* %13
%127 = add nsw i32 %126, 4
store i32 %127, i32* %13
%128 = load i32, i32* %9
%129 = icmp ne i32 %128, 19
br i1 %129, label %130, label %131
130: ; preds = %96
store i32* null, i32** %2
br label %273
131: ; preds = %96
%132 = load i32, i32* %13
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %133
%135 = load i8*, i8** %3
%136 = call i64 @strncmp(i8* %134, i8* %135, i32 19)
%137 = icmp ne i64 %136, 0
br i1 %137, label %138, label %139
138: ; preds = %131
store i32* null, i32** %2
br label %273
139: ; preds = %131
%140 = load i32, i32* %9
%141 = load i32, i32* %13
%142 = add nsw i32 %141, %140
store i32 %142, i32* %13
%143 = load i32, i32* %13
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %144
%146 = load i8, i8* %145
%147 = zext i8 %146 to i32
%148 = shl i32 %147, 24
%149 = load i32, i32* %13
%150 = add nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %151
%153 = load i8, i8* %152
%154 = zext i8 %153 to i32
%155 = shl i32 %154, 16
%156 = add nsw i32 %148, %155
%157 = load i32, i32* %13
%158 = add nsw i32 %157, 2
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %159
%161 = load i8, i8* %160
%162 = zext i8 %161 to i32
%163 = shl i32 %162, 8
%164 = add nsw i32 %156, %163
%165 = load i32, i32* %13
%166 = add nsw i32 %165, 3
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %167
%169 = load i8, i8* %168
%170 = zext i8 %169 to i32
%171 = add nsw i32 %164, %170
store i32 %171, i32* %9
%172 = load i32, i32* %13
%173 = add nsw i32 %172, 4
store i32 %173, i32* %13
%174 = load i32, i32* %9
%175 = icmp ne i32 %174, 8
br i1 %175, label %176, label %177
176: ; preds = %139
store i32* null, i32** %2
br label %273
177: ; preds = %139
%178 = load i32, i32* %13
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %179
%181 = load i8*, i8** %3
%182 = getelementptr inbounds i8, i8* %181, i64 11
%183 = call i64 @strncmp(i8* %180, i8* %182, i32 8)
%184 = icmp ne i64 %183, 0
br i1 %184, label %185, label %186
185: ; preds = %177
store i32* null, i32** %2
br label %273
186: ; preds = %177
%187 = load i32, i32* %9
%188 = load i32, i32* %13
%189 = add nsw i32 %188, %187
store i32 %189, i32* %13
%190 = load i32, i32* %13
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %191
%193 = load i8, i8* %192
%194 = zext i8 %193 to i32
%195 = shl i32 %194, 24
%196 = load i32, i32* %13
%197 = add nsw i32 %196, 1
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %198
%200 = load i8, i8* %199
%201 = zext i8 %200 to i32
%202 = shl i32 %201, 16
%203 = add nsw i32 %195, %202
%204 = load i32, i32* %13
%205 = add nsw i32 %204, 2
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %206
%208 = load i8, i8* %207
%209 = zext i8 %208 to i32
%210 = shl i32 %209, 8
%211 = add nsw i32 %203, %210
%212 = load i32, i32* %13
%213 = add nsw i32 %212, 3
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %214
%216 = load i8, i8* %215
%217 = zext i8 %216 to i32
%218 = add nsw i32 %211, %217
store i32 %218, i32* %9
%219 = load i32, i32* %13
%220 = add nsw i32 %219, 4
store i32 %220, i32* %13
%221 = load i32, i32* %9
%222 = load i32, i32* %10
%223 = mul nsw i32 %222, 2
%224 = add nsw i32 1, %223
%225 = icmp ne i32 %221, %224
br i1 %225, label %226, label %227
226: ; preds = %186
store i32* null, i32** %2
br label %273
227: ; preds = %186
%228 = load i32, i32* %13
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %229
%231 = load i8, i8* %230
%232 = zext i8 %231 to i32
%233 = icmp ne i32 %232, 4
br i1 %233, label %234, label %235
234: ; preds = %227
store i32* null, i32** %2
br label %273
235: ; preds = %227
%236 = load i32, i32* %13
%237 = add nsw i32 %236, 1
store i32 %237, i32* %13
%238 = load i32, i32* %14
%239 = call i32* @EC_KEY_new_by_curve_name(i32 %238)
store i32* %239, i32** %5
%240 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 0
%241 = load i32, i32* %13
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds i8, i8* %240, i64 %242
%244 = load i32, i32* %10
%245 = call i32* @BN_bin2bn(i8* %243, i32 %244, i32* null)
store i32* %245, i32** %6
%246 = load i32, i32* %10
%247 = load i32, i32* %13
%248 = add nsw i32 %247, %246
store i32 %248, i32* %13
%249 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 0
%250 = load i32, i32* %13
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i8, i8* %249, i64 %251
%253 = load i32, i32* %10
%254 = call i32* @BN_bin2bn(i8* %252, i32 %253, i32* null)
store i32* %254, i32** %7
%255 = load i32*, i32** %5
%256 = load i32*, i32** %6
%257 = load i32*, i32** %7
%258 = call i32 @EC_KEY_set_public_key_affine_coordinates(i32* %255, i32* %256, i32* %257)
%259 = icmp ne i32 %258, 0
br i1 %259, label %267, label %260
260: ; preds = %235
%261 = load i32*, i32** %5
%262 = call i32 @EC_KEY_free(i32* %261)
%263 = load i32*, i32** %6
%264 = call i32 @BN_free(i32* %263)
%265 = load i32*, i32** %7
%266 = call i32 @BN_free(i32* %265)
store i32* null, i32** %2
br label %273
267: ; preds = %235
%268 = call i32* (...) @EVP_PKEY_new()
store i32* %268, i32** %4
%269 = load i32*, i32** %4
%270 = load i32*, i32** %5
%271 = call i32 @EVP_PKEY_assign_EC_KEY(i32* %269, i32* %270)
%272 = load i32*, i32** %4
store i32* %272, i32** %2
br label %273
273: ; preds = %267, %260, %234, %226, %185, %176, %138, %130, %95, %42, %35
%274 = load i32*, i32** %2
ret i32* %274
}

LLVM IR (-O2):
@.str = [4 x i8] c"256\00"
@NID_X9_62_prime256v1 = global i32 0
@.str.1 = [4 x i8] c"384\00"
@NID_secp384r1 = global i32 0
@.str.2 = [4 x i8] c"521\00"
@NID_secp521r1 = global i32 0
define i32* @ssh_nistp_line_to_key(i8* %0) {
%2 = alloca [16384 x i8]
%3 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8, i8* %0, i64 16
%5 = tail call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1
%8 = tail call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %124
13: ; preds = %10, %7, %1
%14 = phi i32 [ 32, %1 ], [ 48, %7 ], [ 66, %10 ]
%15 = phi i32* [ @NID_X9_62_prime256v1, %1 ], [ @NID_secp384r1, %7 ], [ @NID_secp521r1, %10 ]
%16 = load i32, i32* %15
%17 = icmp eq i8* %0, null
br i1 %17, label %124, label %18
18: ; preds = %13, %21
%19 = phi i8* [ %22, %21 ], [ %0, %13 ]
%20 = load i8, i8* %19
switch i8 %20, label %21 [
i8 0, label %23
i8 32, label %23
]
21: ; preds = %18
%22 = getelementptr inbounds i8, i8* %19, i64 1
br label %18
23: ; preds = %18, %18
%24 = getelementptr inbounds i8, i8* %19, i64 1
br label %25
25: ; preds = %28, %23
%26 = phi i8* [ %24, %23 ], [ %29, %28 ]
%27 = load i8, i8* %26
switch i8 %27, label %28 [
i8 0, label %30
i8 32, label %30
i8 13, label %30
i8 10, label %30
]
28: ; preds = %25
%29 = getelementptr inbounds i8, i8* %26, i64 1
br label %25
30: ; preds = %25, %25, %25, %25
store i8 0, i8* %26
%31 = call i64 @sc_base64_decode(i8* %24, i8* %3, i32 16384)
%32 = icmp slt i64 %31, 0
br i1 %32, label %124, label %33
33: ; preds = %30
%34 = load i8, i8* %3
%35 = zext i8 %34 to i32
%36 = shl nuw i32 %35, 24
%37 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 1
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = shl nuw nsw i32 %39, 16
%41 = or i32 %40, %36
%42 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 2
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = shl nuw nsw i32 %44, 8
%46 = or i32 %41, %45
%47 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 3
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = or i32 %46, %49
%51 = icmp eq i32 %50, 19
br i1 %51, label %52, label %124
52: ; preds = %33
%53 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 4
%54 = call i64 @strncmp(i8* %53, i8* %0, i32 19)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %124
56: ; preds = %52
%57 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 23
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = shl nuw i32 %59, 24
%61 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 24
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = shl nuw nsw i32 %63, 16
%65 = or i32 %64, %60
%66 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 25
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = shl nuw nsw i32 %68, 8
%70 = or i32 %65, %69
%71 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 26
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = or i32 %70, %73
%75 = icmp eq i32 %74, 8
br i1 %75, label %76, label %124
76: ; preds = %56
%77 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 27
%78 = getelementptr inbounds i8, i8* %0, i64 11
%79 = call i64 @strncmp(i8* %77, i8* %78, i32 8)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %124
81: ; preds = %76
%82 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 35
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = shl nuw i32 %84, 24
%86 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 36
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = shl nuw nsw i32 %88, 16
%90 = or i32 %89, %85
%91 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 37
%92 = load i8, i8* %91
%93 = zext i8 %92 to i32
%94 = shl nuw nsw i32 %93, 8
%95 = or i32 %90, %94
%96 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 38
%97 = load i8, i8* %96
%98 = zext i8 %97 to i32
%99 = or i32 %95, %98
%100 = shl nuw nsw i32 %14, 1
%101 = or i32 %100, 1
%102 = icmp eq i32 %99, %101
%103 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 39
%104 = load i8, i8* %103
%105 = icmp eq i8 %104, 4
%106 = select i1 %102, i1 %105, i1 false
br i1 %106, label %107, label %124
107: ; preds = %81
%108 = call i32* @EC_KEY_new_by_curve_name(i32 %16)
%109 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 40
%110 = call i32* @BN_bin2bn(i8* %109, i32 %14, i32* null)
%111 = add nuw nsw i32 %14, 40
%112 = zext i32 %111 to i64
%113 = getelementptr inbounds [16384 x i8], [16384 x i8]* %2, i64 0, i64 %112
%114 = call i32* @BN_bin2bn(i8* %113, i32 %14, i32* null)
%115 = call i32 @EC_KEY_set_public_key_affine_coordinates(i32* %108, i32* %110, i32* %114)
%116 = icmp eq i32 %115, 0
br i1 %116, label %117, label %121
117: ; preds = %107
%118 = call i32 @EC_KEY_free(i32* %108)
%119 = call i32 @BN_free(i32* %110)
%120 = call i32 @BN_free(i32* %114)
br label %124
121: ; preds = %107
%122 = call i32* (...) @EVP_PKEY_new()
%123 = call i32 @EVP_PKEY_assign_EC_KEY(i32* %122, i32* %108)
br label %124
124: ; preds = %81, %76, %56, %52, %33, %30, %13, %10, %121, %117
%125 = phi i32* [ %122, %121 ], [ null, %117 ], [ null, %10 ], [ null, %13 ], [ null, %30 ], [ null, %33 ], [ null, %52 ], [ null, %56 ], [ null, %76 ], [ null, %81 ]
ret i32* %125
}