#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*/ FILE;

/* Variables and functions */
int do_evp_unseal(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  FILE *rsa_pkey_file;
  int rv;
  if (argc < 2) {
    fprintf(stderr, "Us: %s <RSA Private Key File>\n", argv[0]);
    exit(1);
  }
  rsa_pkey_file = fopen(argv[1], "rb");
  if (!rsa_pkey_file) {
    perror(argv[1]);
    fprintf(stderr, "Error al llegir la clau privada.\n");
    exit(2);
  }
  rv = do_evp_unseal(rsa_pkey_file, stdin, stdout);
  fclose(rsa_pkey_file);
  return rv;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a8 <main+0x48>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f9 <main+0x99>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <perror@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    0x2de4(%rip),%rax
mov    (%rax),%esi
mov    0x2dc3(%rip),%rax
mov    (%rax),%edx
call   1030 <do_evp_unseal@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
cmp    $0x1,%edi
jle    11af <main+0x4f>
mov    0x8(%r14),%rdi
lea    0xea8(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11d3 <main+0x73>
mov    %rax,%rbx
mov    0x2e5d(%rip),%rax
mov    (%rax),%esi
mov    0x2e3c(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1030 <do_evp_unseal@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe3e(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x8(%r14),%rdi
call   1070 <perror@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
lea    0xe36(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"Us: %s <RSA Private Key File>\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [34 x i8] c"Error al llegir la clau privada.\0A\00"
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %6
%22 = load i32*, i32** %6
%23 = icmp ne i32* %22, null
br i1 %23, label %32, label %24
24: ; preds = %17
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @perror(i8* %27)
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @exit(i32 2)
unreachable
32: ; preds = %17
%33 = load i32*, i32** %6
%34 = load i32, i32* @stdin
%35 = load i32, i32* @stdout
%36 = call i32 @do_evp_unseal(i32* %33, i32 %34, i32 %35)
store i32 %36, i32* %7
%37 = load i32*, i32** %6
%38 = call i32 @fclose(i32* %37)
%39 = load i32, i32* %7
ret i32 %39
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"Us: %s <RSA Private Key File>\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [34 x i8] c"Error al llegir la clau privada.\0A\00"
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i32 @perror(i8* %15)
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @exit(i32 2)
unreachable
20: ; preds = %9
%21 = load i32, i32* @stdin
%22 = load i32, i32* @stdout
%23 = tail call i32 @do_evp_unseal(i32* %12, i32 %21, i32 %22)
%24 = tail call i32 @fclose(i32* %12)
ret i32 %23
}