#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*/ PKCS12;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ *BIO_new_file(char *, char *);
scalar_t__ EINVAL;
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
scalar_t__ PKCS12_verify_mac(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ *d2i_PKCS12_bio(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char getopt(int, char **, char *);
char *optarg;
int optind;
char optopt;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int strlen(char *);
int strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  if (argc < 4)
    usage();
  char *psw, *infile, *dict, *nt, *msgintstring, c, verbose;
  int msginterval = 10000;
  ;
  verbose = 0;
  msgintstring = NULL;
  dict = NULL;
  infile = NULL;
  while ((c = getopt(argc, argv, "d:vs:")) != -1)
    switch (c) {
    case 'd':
      dict = optarg;
      break;
    case 'v':
      verbose = 1;
      break;
    case 's':
      verbose = 1;
      msgintstring = optarg;
      break;
    case '?':
      if (optopt == 'd' || optopt == 's') {
        fprintf(stderr, "Option -%c requires an argument.\n", optopt);
      }
    default:
      usage();
    }
  if (optind != argc - 1)
    usage();
  else
    infile = argv[optind];
  if (dict == NULL) {
    fprintf(stderr, "Error: No dictionary file specified\n\n");
    usage();
  }
  if (msgintstring != NULL) {
    msginterval = strtol(msgintstring, NULL, 10);
    if (errno == EINVAL)
      usage();
  } else if (verbose == 1)
    msginterval = 10000;
  ;
  BIO *in = NULL;
  in = BIO_new_file(infile, "rb");
  if (!in) {
    perror("P12 file not found\n");
    exit(10);
  }
  PKCS12 *p12 = NULL;
  if (!(p12 = d2i_PKCS12_bio(in, NULL))) {
    perror("p12 not created\n");
    exit(30);
  }
  FILE *file = fopen(dict, "r");
  if (!file) {
    perror("Dictionary file not found\n");
    exit(20);
  }
  OpenSSL_add_all_algorithms();
  char line[256];
  char found = 0;
  int count = 0;
  while (fgets(line, sizeof line, file) != NULL) {
    if (line[strlen(line) - 1] == '\n')
      line[strlen(line) - 1] = '\0';
    if (strlen(line) > 0 && line[strlen(line) - 1] == '\r')
      line[strlen(line) - 1] = '\0';
    if (verbose == 1) {
      count++;
      if (count % msginterval == 0)
        printf("Attemp %d (%s)\n", count, line);
    }
    if (PKCS12_verify_mac(p12, line, -1)) {
      found = 1;
      break;
    }
  }
  if (found) {
    if (verbose == 1)
      printf("\n********************************************\n");
    printf("Password found: %s\n", line);
    if (verbose == 1)
      printf("********************************************\n\n");
  } else {
    if (verbose == 1)
      printf("\n********************************************\n");
    printf("No password found\n");
    if (verbose == 1)
      printf("********************************************\n\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    120a <main+0x2a>
mov    $0x0,%al
call   10b0 <usage@plt>
movl   $0x2710,-0x40(%rbp)
movb   $0x0,-0x3a(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdc5(%rip),%rdx
call   10e0 <getopt@plt>
mov    %al,-0x39(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     132e <main+0x14e>
movsbl -0x39(%rbp),%eax
mov    %eax,-0x16c(%rbp)
sub    $0x3f,%eax
je     12d6 <main+0xf6>
jmp    1267 <main+0x87>
mov    -0x16c(%rbp),%eax
sub    $0x64,%eax
je     12a3 <main+0xc3>
jmp    127b <main+0x9b>
mov    -0x16c(%rbp),%eax
sub    $0x73,%eax
je     12bf <main+0xdf>
jmp    128f <main+0xaf>
mov    -0x16c(%rbp),%eax
sub    $0x76,%eax
je     12b6 <main+0xd6>
jmp    1322 <main+0x142>
mov    0x2d4e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1329 <main+0x149>
movb   $0x1,-0x3a(%rbp)
jmp    1329 <main+0x149>
movb   $0x1,-0x3a(%rbp)
mov    0x2d2e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1329 <main+0x149>
mov    0x2d03(%rip),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
je     12fc <main+0x11c>
mov    0x2cf0(%rip),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    131d <main+0x13d>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
mov    0x2cd4(%rip),%rax
movsbl (%rax),%edx
lea    0xcf0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1322 <main+0x142>
mov    $0x0,%al
call   10b0 <usage@plt>
jmp    122d <main+0x4d>
mov    0x2ca3(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1351 <main+0x171>
mov    $0x0,%al
call   10b0 <usage@plt>
jmp    1367 <main+0x187>
mov    -0x10(%rbp),%rax
mov    0x2c7c(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1390 <main+0x1b0>
mov    0x2c4f(%rip),%rax
mov    (%rax),%edi
lea    0xca6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   10b0 <usage@plt>
cmpq   $0x0,-0x38(%rbp)
je     13d6 <main+0x1f6>
mov    -0x38(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1090 <strtol@plt>
mov    %eax,-0x40(%rbp)
mov    0x2c09(%rip),%rax
mov    (%rax),%rax
mov    0x2bf7(%rip),%rcx
cmp    (%rcx),%rax
jne    13d1 <main+0x1f1>
mov    $0x0,%al
call   10b0 <usage@plt>
jmp    13ef <main+0x20f>
movsbl -0x3a(%rbp),%eax
cmp    $0x1,%eax
jne    13ea <main+0x20a>
movl   $0x2710,-0x40(%rbp)
jmp    13ef <main+0x20f>
movq   $0x0,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xc4c(%rip),%rsi
call   1100 <BIO_new_file@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    142c <main+0x24c>
lea    0xc34(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xa,%edi
call   10f0 <exit@plt>
movq   $0x0,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <d2i_PKCS12_bio@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    1465 <main+0x285>
lea    0xc0f(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1e,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    0xc06(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    149a <main+0x2ba>
lea    0xbed(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x14,%edi
call   10f0 <exit@plt>
mov    $0x0,%al
call   1080 <OpenSSL_add_all_algorithms@plt>
movb   $0x0,-0x161(%rbp)
movl   $0x0,-0x168(%rbp)
lea    -0x160(%rbp),%rdi
mov    -0x58(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     15db <main+0x3fb>
lea    -0x160(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x160(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    150c <main+0x32c>
lea    -0x160(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x160(%rbp,%rax,1)
lea    -0x160(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
jle    155c <main+0x37c>
lea    -0x160(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x160(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
jne    155c <main+0x37c>
lea    -0x160(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x160(%rbp,%rax,1)
movsbl -0x3a(%rbp),%eax
cmp    $0x1,%eax
jne    15ab <main+0x3cb>
mov    -0x168(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x168(%rbp)
mov    -0x168(%rbp),%eax
cltd
idivl  -0x40(%rbp)
cmp    $0x0,%edx
jne    15a6 <main+0x3c6>
mov    -0x168(%rbp),%esi
lea    -0x160(%rbp),%rdx
lea    0xaf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    15ab <main+0x3cb>
mov    -0x50(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    $0xffffffff,%edx
call   10a0 <PKCS12_verify_mac@plt>
cmp    $0x0,%rax
je     15d6 <main+0x3f6>
movb   $0x1,-0x161(%rbp)
jmp    15db <main+0x3fb>
jmp    14b2 <main+0x2d2>
cmpb   $0x0,-0x161(%rbp)
je     1638 <main+0x458>
movsbl -0x3a(%rbp),%eax
cmp    $0x1,%eax
jne    1603 <main+0x423>
lea    0xaa7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x160(%rbp),%rsi
lea    0xac1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x3a(%rbp),%eax
cmp    $0x1,%eax
jne    1633 <main+0x453>
lea    0xaba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1681 <main+0x4a1>
movsbl -0x3a(%rbp),%eax
cmp    $0x1,%eax
jne    1653 <main+0x473>
lea    0xa57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xabb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x3a(%rbp),%eax
cmp    $0x1,%eax
jne    167c <main+0x49c>
lea    0xa71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1681 <main+0x4a1>
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x3,%edi
jg     1212 <main+0x22>
xor    %eax,%eax
call   10c0 <usage@plt>
lea    0xde7(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   10f0 <getopt@plt>
cmp    $0xff,%al
je     12c4 <main+0xd4>
lea    0xdce(%rip),%r13
xor    %r14d,%r14d
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    126c <main+0x7c>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
lea    0xdb9(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10f0 <getopt@plt>
cmp    $0xff,%al
je     12cd <main+0xdd>
movsbl %al,%eax
cmp    $0x72,%eax
jg     1290 <main+0xa0>
cmp    $0x3f,%eax
je     129f <main+0xaf>
cmp    $0x64,%eax
jne    1254 <main+0x64>
mov    0x2d73(%rip),%rax
mov    (%rax),%r12
jmp    125b <main+0x6b>
nopw   0x0(%rax,%rax,1)
cmp    $0x73,%eax
je     12b5 <main+0xc5>
cmp    $0x76,%eax
jne    1254 <main+0x64>
mov    $0x1,%r14b
jmp    125b <main+0x6b>
mov    0x2d3a(%rip),%rax
movzbl (%rax),%edx
cmp    $0x73,%edx
je     123d <main+0x4d>
cmp    $0x64,%dl
je     123d <main+0x4d>
jmp    1254 <main+0x64>
mov    0x2d3c(%rip),%rax
mov    (%rax),%r15
mov    $0x1,%r14b
jmp    125b <main+0x6b>
xor    %r15d,%r15d
xor    %r12d,%r12d
xor    %r14d,%r14d
mov    0x2d04(%rip),%rax
movslq (%rax),%rax
add    $0xffffffff,%ebp
cmp    %ebp,%eax
jne    12e4 <main+0xf4>
mov    (%rbx,%rax,8),%rbx
jmp    12ed <main+0xfd>
xor    %ebx,%ebx
xor    %eax,%eax
call   10c0 <usage@plt>
mov    %r12,%rbp
test   %r12,%r12
je     132b <main+0x13b>
test   %r15,%r15
je     134e <main+0x15e>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10a0 <strtol@plt>
mov    %eax,%r15d
mov    0x2cad(%rip),%rax
mov    (%rax),%rax
mov    0x2c9b(%rip),%rcx
cmp    (%rcx),%rax
jne    1354 <main+0x164>
xor    %eax,%eax
call   10c0 <usage@plt>
jmp    1354 <main+0x164>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
lea    0xced(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <usage@plt>
test   %r15,%r15
jne    12fa <main+0x10a>
mov    $0x2710,%r15d
lea    0xcf3(%rip),%rsi
mov    %rbx,%rdi
call   1110 <BIO_new_file@plt>
test   %rax,%rax
je     14f1 <main+0x301>
mov    %rax,%rdi
xor    %esi,%esi
call   1060 <d2i_PKCS12_bio@plt>
test   %rax,%rax
je     1507 <main+0x317>
mov    %rax,%r12
lea    0xced(%rip),%rsi
mov    %rbp,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     151d <main+0x32d>
mov    %rax,%rbp
xor    %eax,%eax
call   1090 <OpenSSL_add_all_algorithms@plt>
mov    %rsp,%rbx
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1497 <main+0x2a7>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    13e9 <main+0x1f9>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1415 <main+0x225>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xd,-0x1(%rax,%rbx,1)
jne    1415 <main+0x225>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
cmp    $0x1,%r14b
je     1435 <main+0x245>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   10b0 <PKCS12_verify_mac@plt>
test   %rax,%rax
je     13b0 <main+0x1c0>
jmp    14be <main+0x2ce>
add    $0x1,%r13d
mov    %r13d,%eax
cltd
idiv   %r15d
test   %edx,%edx
jne    1458 <main+0x268>
lea    0xc48(%rip),%rdi
mov    %r13d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   10b0 <PKCS12_verify_mac@plt>
test   %rax,%rax
je     13b0 <main+0x1c0>
lea    0xc7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xc1f(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc34(%rip),%rdi
jmp    14d8 <main+0x2e8>
cmp    $0x1,%r14b
jne    14d1 <main+0x2e1>
lea    0xc53(%rip),%rdi
call   1030 <puts@plt>
lea    0xc07(%rip),%rdi
call   1030 <puts@plt>
lea    0xc0d(%rip),%rdi
jmp    14d8 <main+0x2e8>
lea    0xbde(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    14dd <main+0x2ed>
lea    0xbdf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb59(%rip),%rdi
call   10e0 <perror@plt>
mov    $0xa,%edi
call   1100 <exit@plt>
lea    0xb57(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1e,%edi
call   1100 <exit@plt>
lea    0xb54(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x14,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"d:vs:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@optind = global i32 0
@.str.2 = [38 x i8] c"Error: No dictionary file specified\0A\0A\00"
@errno = global i64 0
@EINVAL = global i64 0
@.str.3 = [3 x i8] c"rb\00"
@.str.4 = [20 x i8] c"P12 file not found\0A\00"
@.str.5 = [17 x i8] c"p12 not created\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [27 x i8] c"Dictionary file not found\0A\00"
@.str.8 = [16 x i8] c"Attemp %d (%s)\0A\00"
@.str.9 = [47 x i8] c"\0A********************************************\0A\00"
@.str.10 = [20 x i8] c"Password found: %s\0A\00"
@.str.11 = [47 x i8] c"********************************************\0A\0A\00"
@.str.12 = [19 x i8] c"No password found\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca [256 x i8]
%18 = alloca i8
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 4
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (...) @usage()
br label %24
24: ; preds = %22, %2
store i32 10000, i32* %13
store i8 0, i8* %12
store i8* null, i8** %10
store i8* null, i8** %8
store i8* null, i8** %7
br label %25
25: ; preds = %55, %24
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call signext i8 @getopt(i32 %26, i8** %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8 %28, i8* %11
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, -1
br i1 %30, label %31, label %56
31: ; preds = %25
%32 = load i8, i8* %11
%33 = sext i8 %32 to i32
switch i32 %33, label %53 [
i32 100, label %34
i32 118, label %36
i32 115, label %37
i32 63, label %39
]
34: ; preds = %31
%35 = load i8*, i8** @optarg
store i8* %35, i8** %8
br label %55
36: ; preds = %31
store i8 1, i8* %12
br label %55
37: ; preds = %31
store i8 1, i8* %12
%38 = load i8*, i8** @optarg
store i8* %38, i8** %10
br label %55
39: ; preds = %31
%40 = load i8, i8* @optopt
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 100
br i1 %42, label %47, label %43
43: ; preds = %39
%44 = load i8, i8* @optopt
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 115
br i1 %46, label %47, label %52
47: ; preds = %43, %39
%48 = load i32, i32* @stderr
%49 = load i8, i8* @optopt
%50 = sext i8 %49 to i32
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %47, %43
br label %53
53: ; preds = %31, %52
%54 = call i32 (...) @usage()
br label %55
55: ; preds = %53, %37, %36, %34
br label %25
56: ; preds = %25
%57 = load i32, i32* @optind
%58 = load i32, i32* %4
%59 = sub nsw i32 %58, 1
%60 = icmp ne i32 %57, %59
br i1 %60, label %61, label %63
61: ; preds = %56
%62 = call i32 (...) @usage()
br label %69
63: ; preds = %56
%64 = load i8**, i8*** %5
%65 = load i32, i32* @optind
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
store i8* %68, i8** %7
br label %69
69: ; preds = %63, %61
%70 = load i8*, i8** %8
%71 = icmp eq i8* %70, null
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%75 = call i32 (...) @usage()
br label %76
76: ; preds = %72, %69
%77 = load i8*, i8** %10
%78 = icmp ne i8* %77, null
br i1 %78, label %79, label %88
79: ; preds = %76
%80 = load i8*, i8** %10
%81 = call i32 @strtol(i8* %80, i32* null, i32 10)
store i32 %81, i32* %13
%82 = load i64, i64* @errno
%83 = load i64, i64* @EINVAL
%84 = icmp eq i64 %82, %83
br i1 %84, label %85, label %87
85: ; preds = %79
%86 = call i32 (...) @usage()
br label %87
87: ; preds = %85, %79
br label %94
88: ; preds = %76
%89 = load i8, i8* %12
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 1
br i1 %91, label %92, label %93
92: ; preds = %88
store i32 10000, i32* %13
br label %93
93: ; preds = %92, %88
br label %94
94: ; preds = %93, %87
store i32* null, i32** %14
%95 = load i8*, i8** %7
%96 = call i32* @BIO_new_file(i8* %95, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %96, i32** %14
%97 = load i32*, i32** %14
%98 = icmp ne i32* %97, null
br i1 %98, label %102, label %99
99: ; preds = %94
%100 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%101 = call i32 @exit(i32 10)
unreachable
102: ; preds = %94
store i32* null, i32** %15
%103 = load i32*, i32** %14
%104 = call i32* @d2i_PKCS12_bio(i32* %103, i32* null)
store i32* %104, i32** %15
%105 = icmp ne i32* %104, null
br i1 %105, label %109, label %106
106: ; preds = %102
%107 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%108 = call i32 @exit(i32 30)
unreachable
109: ; preds = %102
%110 = load i8*, i8** %8
%111 = call i32* @fopen(i8* %110, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %111, i32** %16
%112 = load i32*, i32** %16
%113 = icmp ne i32* %112, null
br i1 %113, label %117, label %114
114: ; preds = %109
%115 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%116 = call i32 @exit(i32 20)
unreachable
117: ; preds = %109
%118 = call i32 (...) @OpenSSL_add_all_algorithms()
store i8 0, i8* %18
store i32 0, i32* %19
br label %119
119: ; preds = %180, %117
%120 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%121 = load i32*, i32** %16
%122 = call i32* @fgets(i8* %120, i32 256, i32* %121)
%123 = icmp ne i32* %122, null
br i1 %123, label %124, label %181
124: ; preds = %119
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%126 = call i32 @strlen(i8* %125)
%127 = sub nsw i32 %126, 1
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = icmp eq i32 %131, 10
br i1 %132, label %133, label %139
133: ; preds = %124
%134 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%135 = call i32 @strlen(i8* %134)
%136 = sub nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %137
store i8 0, i8* %138
br label %139
139: ; preds = %133, %124
%140 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%141 = call i32 @strlen(i8* %140)
%142 = icmp sgt i32 %141, 0
br i1 %142, label %143, label %158
143: ; preds = %139
%144 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%145 = call i32 @strlen(i8* %144)
%146 = sub nsw i32 %145, 1
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %147
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp eq i32 %150, 13
br i1 %151, label %152, label %158
152: ; preds = %143
%153 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%154 = call i32 @strlen(i8* %153)
%155 = sub nsw i32 %154, 1
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %156
store i8 0, i8* %157
br label %158
158: ; preds = %152, %143, %139
%159 = load i8, i8* %12
%160 = sext i8 %159 to i32
%161 = icmp eq i32 %160, 1
br i1 %161, label %162, label %174
162: ; preds = %158
%163 = load i32, i32* %19
%164 = add nsw i32 %163, 1
store i32 %164, i32* %19
%165 = load i32, i32* %19
%166 = load i32, i32* %13
%167 = srem i32 %165, %166
%168 = icmp eq i32 %167, 0
br i1 %168, label %169, label %173
169: ; preds = %162
%170 = load i32, i32* %19
%171 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %170, i8* %171)
br label %173
173: ; preds = %169, %162
br label %174
174: ; preds = %173, %158
%175 = load i32*, i32** %15
%176 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%177 = call i64 @PKCS12_verify_mac(i32* %175, i8* %176, i32 -1)
%178 = icmp ne i64 %177, 0
br i1 %178, label %179, label %180
179: ; preds = %174
store i8 1, i8* %18
br label %181
180: ; preds = %174
br label %119
181: ; preds = %179, %119
%182 = load i8, i8* %18
%183 = icmp ne i8 %182, 0
br i1 %183, label %184, label %199
184: ; preds = %181
%185 = load i8, i8* %12
%186 = sext i8 %185 to i32
%187 = icmp eq i32 %186, 1
br i1 %187, label %188, label %190
188: ; preds = %184
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0))
br label %190
190: ; preds = %188, %184
%191 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %191)
%193 = load i8, i8* %12
%194 = sext i8 %193 to i32
%195 = icmp eq i32 %194, 1
br i1 %195, label %196, label %198
196: ; preds = %190
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
br label %198
198: ; preds = %196, %190
br label %213
199: ; preds = %181
%200 = load i8, i8* %12
%201 = sext i8 %200 to i32
%202 = icmp eq i32 %201, 1
br i1 %202, label %203, label %205
203: ; preds = %199
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0))
br label %205
205: ; preds = %203, %199
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0))
%207 = load i8, i8* %12
%208 = sext i8 %207 to i32
%209 = icmp eq i32 %208, 1
br i1 %209, label %210, label %212
210: ; preds = %205
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
br label %212
212: ; preds = %210, %205
br label %213
213: ; preds = %212, %198
%214 = load i32, i32* %3
ret i32 %214
}

LLVM IR (-O2):
@.str = [6 x i8] c"d:vs:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@optind = global i32 0
@.str.2 = [38 x i8] c"Error: No dictionary file specified\0A\0A\00"
@errno = global i64 0
@EINVAL = global i64 0
@.str.3 = [3 x i8] c"rb\00"
@.str.4 = [20 x i8] c"P12 file not found\0A\00"
@.str.5 = [17 x i8] c"p12 not created\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [27 x i8] c"Dictionary file not found\0A\00"
@.str.8 = [16 x i8] c"Attemp %d (%s)\0A\00"
@.str.10 = [20 x i8] c"Password found: %s\0A\00"
@str = [18 x i8] c"No password found\00"
@str.15 = [46 x i8] c"********************************************\0A\00"
@str.16 = [46 x i8] c"\0A********************************************\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [256 x i8]
%4 = icmp slt i32 %0, 4
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @usage()
br label %7
7: ; preds = %5, %2
%8 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i8 %8, -1
br i1 %9, label %34, label %10
10: ; preds = %7, %28
%11 = phi i8 [ %32, %28 ], [ %8, %7 ]
%12 = phi i8 [ %31, %28 ], [ 0, %7 ]
%13 = phi i8* [ %30, %28 ], [ null, %7 ]
%14 = phi i8* [ %29, %28 ], [ null, %7 ]
%15 = sext i8 %11 to i32
switch i32 %15, label %26 [
i32 100, label %16
i32 118, label %28
i32 115, label %18
i32 63, label %20
]
16: ; preds = %10
%17 = load i8*, i8** @optarg
br label %28
18: ; preds = %10
%19 = load i8*, i8** @optarg
br label %28
20: ; preds = %10
%21 = load i8, i8* @optopt
switch i8 %21, label %26 [
i8 115, label %22
i8 100, label %22
]
22: ; preds = %20, %20
%23 = zext i8 %21 to i32
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %26
26: ; preds = %20, %22, %10
%27 = tail call i32 (...) @usage()
br label %28
28: ; preds = %10, %26, %18, %16
%29 = phi i8* [ %14, %26 ], [ %19, %18 ], [ %14, %16 ], [ %14, %10 ]
%30 = phi i8* [ %13, %26 ], [ %13, %18 ], [ %17, %16 ], [ %13, %10 ]
%31 = phi i8 [ %12, %26 ], [ 1, %18 ], [ %12, %16 ], [ 1, %10 ]
%32 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%33 = icmp eq i8 %32, -1
br i1 %33, label %34, label %10
34: ; preds = %28, %7
%35 = phi i8* [ null, %7 ], [ %29, %28 ]
%36 = phi i8* [ null, %7 ], [ %30, %28 ]
%37 = phi i8 [ 0, %7 ], [ %31, %28 ]
%38 = load i32, i32* @optind
%39 = add nsw i32 %0, -1
%40 = icmp eq i32 %38, %39
br i1 %40, label %43, label %41
41: ; preds = %34
%42 = tail call i32 (...) @usage()
br label %47
43: ; preds = %34
%44 = sext i32 %38 to i64
%45 = getelementptr inbounds i8*, i8** %1, i64 %44
%46 = load i8*, i8** %45
br label %47
47: ; preds = %43, %41
%48 = phi i8* [ null, %41 ], [ %46, %43 ]
%49 = icmp eq i8* %36, null
br i1 %49, label %50, label %54
50: ; preds = %47
%51 = load i32, i32* @stderr
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%53 = tail call i32 (...) @usage()
br label %54
54: ; preds = %50, %47
%55 = icmp eq i8* %35, null
br i1 %55, label %63, label %56
56: ; preds = %54
%57 = tail call i32 @strtol(i8* nocapture %35, i32* null, i32 10)
%58 = load i64, i64* @errno
%59 = load i64, i64* @EINVAL
%60 = icmp eq i64 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %56
%62 = tail call i32 (...) @usage()
br label %63
63: ; preds = %54, %56, %61
%64 = phi i32 [ %57, %61 ], [ %57, %56 ], [ 10000, %54 ]
%65 = tail call i32* @BIO_new_file(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%66 = icmp eq i32* %65, null
br i1 %66, label %67, label %70
67: ; preds = %63
%68 = tail call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%69 = tail call i32 @exit(i32 10)
unreachable
70: ; preds = %63
%71 = tail call i32* @d2i_PKCS12_bio(i32* %65, i32* null)
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%75 = tail call i32 @exit(i32 30)
unreachable
76: ; preds = %70
%77 = tail call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%78 = icmp eq i32* %77, null
br i1 %78, label %79, label %82
79: ; preds = %76
%80 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%81 = tail call i32 @exit(i32 20)
unreachable
82: ; preds = %76
%83 = tail call i32 (...) @OpenSSL_add_all_algorithms()
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%85 = icmp eq i8 %37, 1
br label %86
86: ; preds = %125, %82
%87 = phi i32 [ %120, %125 ], [ 0, %82 ]
br label %88
88: ; preds = %86, %128
%89 = call i32* @fgets(i8* %84, i32 256, i32* %77)
%90 = icmp eq i32* %89, null
br i1 %90, label %135, label %91
91: ; preds = %88
%92 = call i32 @strlen(i8* %84)
%93 = add nsw i32 %92, -1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %94
%96 = load i8, i8* %95
%97 = icmp eq i8 %96, 10
br i1 %97, label %98, label %103
98: ; preds = %91
%99 = call i32 @strlen(i8* %84)
%100 = add nsw i32 %99, -1
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %101
store i8 0, i8* %102
br label %103
103: ; preds = %98, %91
%104 = call i32 @strlen(i8* %84)
%105 = icmp sgt i32 %104, 0
br i1 %105, label %106, label %118
106: ; preds = %103
%107 = call i32 @strlen(i8* %84)
%108 = add nsw i32 %107, -1
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = icmp eq i8 %111, 13
br i1 %112, label %113, label %118
113: ; preds = %106
%114 = call i32 @strlen(i8* %84)
%115 = add nsw i32 %114, -1
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %116
store i8 0, i8* %117
br label %118
118: ; preds = %113, %106, %103
br i1 %85, label %119, label %128
119: ; preds = %118
%120 = add nuw nsw i32 %87, 1
%121 = srem i32 %120, %64
%122 = icmp eq i32 %121, 0
br i1 %122, label %123, label %125
123: ; preds = %119
%124 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %120, i8* %84)
br label %125
125: ; preds = %119, %123
%126 = call i64 @PKCS12_verify_mac(i32* %71, i8* %84, i32 -1)
%127 = icmp eq i64 %126, 0
br i1 %127, label %86, label %131
128: ; preds = %118
%129 = call i64 @PKCS12_verify_mac(i32* %71, i8* %84, i32 -1)
%130 = icmp eq i64 %129, 0
br i1 %130, label %88, label %140
131: ; preds = %125
%132 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.16, i64 0, i64 0))
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %84)
%134 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.15, i64 0, i64 0))
br label %144
135: ; preds = %88
br i1 %85, label %136, label %142
136: ; preds = %135
%137 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.16, i64 0, i64 0))
%138 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.15, i64 0, i64 0))
br label %144
140: ; preds = %128
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %84)
br label %144
142: ; preds = %135
%143 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %144
144: ; preds = %142, %140, %136, %131
ret i32 0
}