#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*/ X509;
typedef int /*<<< orphan*/ RSA;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ EVP_PKEY;

/* Variables and functions */
int /*<<< orphan*/ EVP_PKEY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_new();
int EVP_PKEY_set1_RSA(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
int /*<<< orphan*/ *PEM_read_RSAPrivateKey(int /*<<< orphan*/ *,
                                           int /*<<< orphan*/ *,
                                           int /*<<< orphan*/ *,
                                           int /*<<< orphan*/ *);
int /*<<< orphan*/ *PEM_read_X509(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int /*<<< orphan*/);
int PICA_do_signature(int /*<<< orphan*/ *, void **, int *, unsigned char **,
                      int *);
int PICA_signverify(int /*<<< orphan*/ *, void **, int *, unsigned char *, int);
int /*<<< orphan*/ RAND_pseudo_bytes(char *, int);
int /*<<< orphan*/ RSA_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *X509_get_pubkey(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char databuf[512];
  void *dataptrs[2];
  int datalengths[2];
  unsigned char *sig;
  int siglen;
  int ret;
  EVP_PKEY *privkey, *pubkey;
  FILE *f;
  X509 *x;
  RSA *rsa;
  OpenSSL_add_all_algorithms();
  RAND_pseudo_bytes(databuf, sizeof databuf);
  dataptrs[0] = databuf;
  datalengths[0] = sizeof databuf;
  dataptrs[1] = NULL;
  datalengths[1] = 0;
  f = fopen(argv[1], "r");
  if (!f) {
    fprintf(stderr, "failed to open %s\n", argv[1]);
    return -1;
  }
  privkey = EVP_PKEY_new();
  x = PEM_read_X509(f, 0, 0, 0);
  if (!x) {
    fprintf(stderr, "failed to read X.509 cert from file");
    return -1;
  }
  pubkey = X509_get_pubkey(x);
  if (!pubkey) {
    fprintf(stderr, "no pubkey found");
  }
  rsa = PEM_read_RSAPrivateKey(f, NULL, NULL, NULL);
  fclose(f);
  if (!rsa) {
    fprintf(stderr, "failed to read RSA private key from file");
    return -1;
  }
  ret = EVP_PKEY_set1_RSA(privkey, rsa);
  ret = PICA_do_signature(privkey, dataptrs, datalengths, &sig, &siglen);
  ret = PICA_signverify(pubkey, dataptrs, datalengths, sig, siglen);
  printf("signature length is %i octets\n", siglen);
  if (ret != 1) {
    fprintf(stderr, "signature verification failed\n");
    return -1;
  }
  databuf[0] += 1;
  ret = PICA_signverify(pubkey, dataptrs, datalengths, sig, siglen);
  if (ret == 1) {
    fprintf(stderr, "err signature matched on corrupted data!\n");
    return -1;
  }
  free(sig);
  RSA_free(rsa);
  EVP_PKEY_free(pubkey);
  EVP_PKEY_free(privkey);
  X509_free(x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10b0 <OpenSSL_add_all_algorithms@plt>
lea    -0x210(%rbp),%rdi
mov    $0x200,%esi
call   10d0 <RAND_pseudo_bytes@plt>
lea    -0x210(%rbp),%rax
mov    %rax,-0x220(%rbp)
movl   $0x200,-0x228(%rbp)
movq   $0x0,-0x218(%rbp)
movl   $0x0,-0x224(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd83(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x250(%rbp)
cmpq   $0x0,-0x250(%rbp)
jne    12c2 <main+0xb2>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd53(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1514 <main+0x304>
mov    $0x0,%al
call   10f0 <EVP_PKEY_new@plt>
mov    %rax,-0x240(%rbp)
mov    -0x250(%rbp),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <PEM_read_X509@plt>
mov    %rax,-0x258(%rbp)
cmpq   $0x0,-0x258(%rbp)
jne    131a <main+0x10a>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
lea    0xd0e(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1514 <main+0x304>
mov    -0x258(%rbp),%rdi
call   10c0 <X509_get_pubkey@plt>
mov    %rax,-0x248(%rbp)
cmpq   $0x0,-0x248(%rbp)
jne    1352 <main+0x142>
mov    0x2c9e(%rip),%rax
mov    (%rax),%edi
lea    0xcee(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x250(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
mov    %rcx,%rdx
call   10e0 <PEM_read_RSAPrivateKey@plt>
mov    %rax,-0x260(%rbp)
mov    -0x250(%rbp),%rdi
call   1060 <fclose@plt>
cmpq   $0x0,-0x260(%rbp)
jne    13ac <main+0x19c>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
lea    0xcb0(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1514 <main+0x304>
mov    -0x240(%rbp),%rdi
mov    -0x260(%rbp),%rsi
call   1130 <EVP_PKEY_set1_RSA@plt>
mov    %eax,-0x238(%rbp)
mov    -0x240(%rbp),%rdi
lea    -0x220(%rbp),%rsi
lea    -0x228(%rbp),%rdx
lea    -0x230(%rbp),%rcx
lea    -0x234(%rbp),%r8
call   1120 <PICA_do_signature@plt>
mov    %eax,-0x238(%rbp)
mov    -0x248(%rbp),%rdi
lea    -0x220(%rbp),%rsi
lea    -0x228(%rbp),%rdx
mov    -0x230(%rbp),%rcx
mov    -0x234(%rbp),%r8d
call   1050 <PICA_signverify@plt>
mov    %eax,-0x238(%rbp)
mov    -0x234(%rbp),%esi
lea    0xc44(%rip),%rdi
call   1080 <printf@plt>
cmpl   $0x1,-0x238(%rbp)
je     1463 <main+0x253>
mov    0x2b99(%rip),%rax
mov    (%rax),%edi
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1514 <main+0x304>
movsbl -0x210(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x210(%rbp)
mov    -0x248(%rbp),%rdi
lea    -0x220(%rbp),%rsi
lea    -0x228(%rbp),%rdx
mov    -0x230(%rbp),%rcx
mov    -0x234(%rbp),%r8d
call   1050 <PICA_signverify@plt>
mov    %eax,-0x238(%rbp)
cmpl   $0x1,-0x238(%rbp)
jne    14d1 <main+0x2c1>
mov    0x2b2b(%rip),%rax
mov    (%rax),%edi
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1514 <main+0x304>
mov    -0x230(%rbp),%rdi
call   1040 <free@plt>
mov    -0x260(%rbp),%rdi
call   1070 <RSA_free@plt>
mov    -0x248(%rbp),%rdi
call   1090 <EVP_PKEY_free@plt>
mov    -0x240(%rbp),%rdi
call   1090 <EVP_PKEY_free@plt>
mov    -0x258(%rbp),%rdi
call   1100 <X509_free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
call   10b0 <OpenSSL_add_all_algorithms@plt>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x200,%esi
call   10d0 <RAND_pseudo_bytes@plt>
mov    %rbp,0x20(%rsp)
movq   $0x200,0x18(%rsp)
movq   $0x0,0x28(%rsp)
mov    0x8(%rbx),%rdi
lea    0xda1(%rip),%rsi
call   1110 <fopen@plt>
test   %rax,%rax
je     1375 <main+0x165>
mov    %rax,%rbp
xor    %eax,%eax
call   10f0 <EVP_PKEY_new@plt>
mov    %rax,%r14
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <PEM_read_X509@plt>
test   %rax,%rax
je     1392 <main+0x182>
mov    %rax,%r13
mov    %rax,%rdi
call   10c0 <X509_get_pubkey@plt>
mov    %rax,%r15
test   %rax,%rax
jne    12bb <main+0xab>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
lea    0xd85(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   10e0 <PEM_read_RSAPrivateKey@plt>
mov    %rax,%r12
mov    %rbp,%rdi
call   1060 <fclose@plt>
test   %r12,%r12
je     13a4 <main+0x194>
mov    %r14,%rdi
mov    %r12,%rsi
call   1130 <EVP_PKEY_set1_RSA@plt>
lea    0x20(%rsp),%rbx
lea    0x18(%rsp),%rbp
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1120 <PICA_do_signature@plt>
mov    0x10(%rsp),%rcx
mov    0xc(%rsp),%r8d
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <PICA_signverify@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%esi
lea    0xd43(%rip),%rdi
call   1080 <printf@plt>
cmp    $0x1,%ebx
jne    13b6 <main+0x1a6>
addb   $0x1,0x30(%rsp)
mov    0x10(%rsp),%rcx
mov    0xc(%rsp),%r8d
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
mov    %r15,%rdi
call   1050 <PICA_signverify@plt>
cmp    $0x1,%eax
jne    13e4 <main+0x1d4>
mov    0x2c76(%rip),%rax
mov    (%rax),%edi
lea    0xd3d(%rip),%rsi
jmp    13c6 <main+0x1b6>
mov    0x2c64(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xc79(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    13cd <main+0x1bd>
mov    0x2c47(%rip),%rax
mov    (%rax),%edi
lea    0xc73(%rip),%rsi
jmp    13c6 <main+0x1b6>
mov    0x2c35(%rip),%rax
mov    (%rax),%edi
lea    0xc95(%rip),%rsi
jmp    13c6 <main+0x1b6>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
lea    0xccb(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%rdi
call   1040 <free@plt>
mov    %r12,%rdi
call   1070 <RSA_free@plt>
mov    %r15,%rdi
call   1090 <EVP_PKEY_free@plt>
mov    %r14,%rdi
call   1090 <EVP_PKEY_free@plt>
mov    %r13,%rdi
call   1100 <X509_free@plt>
xor    %eax,%eax
jmp    13d2 <main+0x1c2>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"failed to open %s\0A\00"
@.str.2 = [36 x i8] c"failed to read X.509 cert from file\00"
@.str.3 = [16 x i8] c"no pubkey found\00"
@.str.4 = [41 x i8] c"failed to read RSA private key from file\00"
@.str.5 = [31 x i8] c"signature length is %i octets\0A\00"
@.str.6 = [31 x i8] c"signature verification failed\0A\00"
@.str.7 = [42 x i8] c"err signature matched on corrupted data!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca [2 x i8*]
%8 = alloca [2 x i32]
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = call i32 (...) @OpenSSL_add_all_algorithms()
%18 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%19 = call i32 @RAND_pseudo_bytes(i8* %18, i32 512)
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%21 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
store i8* %20, i8** %21
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 512, i32* %22
%23 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 1
store i8* null, i8** %23
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
store i32 0, i32* %24
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %28, i32** %14
%29 = load i32*, i32** %14
%30 = icmp ne i32* %29, null
br i1 %30, label %37, label %31
31: ; preds = %2
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %35)
store i32 -1, i32* %3
br label %113
37: ; preds = %2
%38 = call i32* (...) @EVP_PKEY_new()
store i32* %38, i32** %12
%39 = load i32*, i32** %14
%40 = call i32* @PEM_read_X509(i32* %39, i32 0, i32 0, i32 0)
store i32* %40, i32** %15
%41 = load i32*, i32** %15
%42 = icmp ne i32* %41, null
br i1 %42, label %46, label %43
43: ; preds = %37
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %113
46: ; preds = %37
%47 = load i32*, i32** %15
%48 = call i32* @X509_get_pubkey(i32* %47)
store i32* %48, i32** %13
%49 = load i32*, i32** %13
%50 = icmp ne i32* %49, null
br i1 %50, label %54, label %51
51: ; preds = %46
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %51, %46
%55 = load i32*, i32** %14
%56 = call i32* @PEM_read_RSAPrivateKey(i32* %55, i32* null, i32* null, i32* null)
store i32* %56, i32** %16
%57 = load i32*, i32** %14
%58 = call i32 @fclose(i32* %57)
%59 = load i32*, i32** %16
%60 = icmp ne i32* %59, null
br i1 %60, label %64, label %61
61: ; preds = %54
%62 = load i32, i32* @stderr
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %113
64: ; preds = %54
%65 = load i32*, i32** %12
%66 = load i32*, i32** %16
%67 = call i32 @EVP_PKEY_set1_RSA(i32* %65, i32* %66)
store i32 %67, i32* %11
%68 = load i32*, i32** %12
%69 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%71 = call i32 @PICA_do_signature(i32* %68, i8** %69, i32* %70, i8** %9, i32* %10)
store i32 %71, i32* %11
%72 = load i32*, i32** %13
%73 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%74 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%75 = load i8*, i8** %9
%76 = load i32, i32* %10
%77 = call i32 @PICA_signverify(i32* %72, i8** %73, i32* %74, i8* %75, i32 %76)
store i32 %77, i32* %11
%78 = load i32, i32* %10
%79 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %11
%81 = icmp ne i32 %80, 1
br i1 %81, label %82, label %85
82: ; preds = %64
%83 = load i32, i32* @stderr
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %113
85: ; preds = %64
%86 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = add nsw i32 %88, 1
%90 = trunc i32 %89 to i8
store i8 %90, i8* %86
%91 = load i32*, i32** %13
%92 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%94 = load i8*, i8** %9
%95 = load i32, i32* %10
%96 = call i32 @PICA_signverify(i32* %91, i8** %92, i32* %93, i8* %94, i32 %95)
store i32 %96, i32* %11
%97 = load i32, i32* %11
%98 = icmp eq i32 %97, 1
br i1 %98, label %99, label %102
99: ; preds = %85
%100 = load i32, i32* @stderr
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %3
br label %113
102: ; preds = %85
%103 = load i8*, i8** %9
%104 = call i32 @free(i8* %103)
%105 = load i32*, i32** %16
%106 = call i32 @RSA_free(i32* %105)
%107 = load i32*, i32** %13
%108 = call i32 @EVP_PKEY_free(i32* %107)
%109 = load i32*, i32** %12
%110 = call i32 @EVP_PKEY_free(i32* %109)
%111 = load i32*, i32** %15
%112 = call i32 @X509_free(i32* %111)
store i32 0, i32* %3
br label %113
113: ; preds = %102, %99, %82, %61, %43, %31
%114 = load i32, i32* %3
ret i32 %114
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"failed to open %s\0A\00"
@.str.2 = [36 x i8] c"failed to read X.509 cert from file\00"
@.str.3 = [16 x i8] c"no pubkey found\00"
@.str.4 = [41 x i8] c"failed to read RSA private key from file\00"
@.str.5 = [31 x i8] c"signature length is %i octets\0A\00"
@.str.6 = [31 x i8] c"signature verification failed\0A\00"
@.str.7 = [42 x i8] c"err signature matched on corrupted data!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = alloca [2 x i8*]
%5 = alloca [2 x i32]
%6 = alloca i8*
%7 = alloca i32
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%9 = bitcast [2 x i8*]* %4 to i8*
%10 = bitcast [2 x i32]* %5 to i8*
%11 = bitcast i8** %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = tail call i32 (...) @OpenSSL_add_all_algorithms()
%14 = call i32 @RAND_pseudo_bytes(i8* %8, i32 512)
%15 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
store i8* %8, i8** %15
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 512, i32* %16
%17 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 1
store i8* null, i8** %17
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 0, i32* %18
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %27
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %19
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %76
27: ; preds = %2
%28 = call i32* (...) @EVP_PKEY_new()
%29 = call i32* @PEM_read_X509(i32* %21, i32 0, i32 0, i32 0)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %76
34: ; preds = %27
%35 = call i32* @X509_get_pubkey(i32* %29)
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %37, %34
%41 = call i32* @PEM_read_RSAPrivateKey(i32* %21, i32* null, i32* null, i32* null)
%42 = call i32 @fclose(i32* %21)
%43 = icmp eq i32* %41, null
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
br label %76
47: ; preds = %40
%48 = call i32 @EVP_PKEY_set1_RSA(i32* %28, i32* %41)
%49 = call i32 @PICA_do_signature(i32* %28, i8** %15, i32* %16, i8** %6, i32* %7)
%50 = load i8*, i8** %6
%51 = load i32, i32* %7
%52 = call i32 @PICA_signverify(i32* %35, i8** %15, i32* %16, i8* %50, i32 %51)
%53 = load i32, i32* %7
%54 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %53)
%55 = icmp eq i32 %52, 1
br i1 %55, label %59, label %56
56: ; preds = %47
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %76
59: ; preds = %47
%60 = load i8, i8* %8
%61 = add i8 %60, 1
store i8 %61, i8* %8
%62 = load i8*, i8** %6
%63 = load i32, i32* %7
%64 = call i32 @PICA_signverify(i32* %35, i8** %15, i32* %16, i8* %62, i32 %63)
%65 = icmp eq i32 %64, 1
br i1 %65, label %66, label %69
66: ; preds = %59
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %76
69: ; preds = %59
%70 = load i8*, i8** %6
%71 = call i32 @free(i8* %70)
%72 = call i32 @RSA_free(i32* %41)
%73 = call i32 @EVP_PKEY_free(i32* %35)
%74 = call i32 @EVP_PKEY_free(i32* %28)
%75 = call i32 @X509_free(i32* %29)
br label %76
76: ; preds = %69, %66, %56, %44, %31, %23
%77 = phi i32 [ -1, %56 ], [ -1, %66 ], [ 0, %69 ], [ -1, %44 ], [ -1, %31 ], [ -1, %23 ]
ret i32 %77
}