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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int fs_read(char *, unsigned char *, int);
scalar_t__ keygen_getenv(long *);
int /*<<< orphan*/ printf(char *);
void read_parameters(char **argv, unsigned char *encrypted_text,
                     long *cant_keys) {
  char *path = argv[1];
  if (fs_read(path, encrypted_text, 8) != 8) {
    printf("\nerror opening the encrypted file\n");
    exit(-1);
  }
  if (keygen_getenv(cant_keys) != 0) {
    printf("\nerror reading enviroment\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<read_parameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1040 <fs_read@plt>
cmp    $0x8,%eax
je     1191 <read_parameters+0x51>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1050 <keygen_getenv@plt>
cmp    $0x0,%rax
je     11ba <read_parameters+0x7a>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_parameters>:
push   %rbx
mov    %rdx,%rbx
mov    0x8(%rdi),%rdi
mov    $0x8,%edx
call   1040 <fs_read@plt>
cmp    $0x8,%eax
jne    1166 <read_parameters+0x26>
mov    %rbx,%rdi
call   1050 <keygen_getenv@plt>
test   %rax,%rax
jne    116f <read_parameters+0x2f>
pop    %rbx
ret
lea    0xead(%rip),%rdi
jmp    1176 <read_parameters+0x36>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"\0Aerror opening the encrypted file\0A\00"
@.str.1 = [27 x i8] c"\0Aerror reading enviroment\0A\00"
define void @read_parameters(i8** %0, i8* %1, i64* %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i8*
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i64* %2, i64** %6
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = load i8*, i8** %5
%13 = call i32 @fs_read(i8* %11, i8* %12, i32 8)
%14 = icmp ne i32 %13, 8
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %3
%19 = load i64*, i64** %6
%20 = call i64 @keygen_getenv(i64* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @exit(i32 -1)
unreachable
25: ; preds = %18
ret void
}

LLVM IR (-O2):
@str = [26 x i8] c"\0Aerror reading enviroment\00"
@str.2 = [34 x i8] c"\0Aerror opening the encrypted file\00"
define void @read_parameters(i8** nocapture %0, i8* %1, i64* %2) {
%4 = getelementptr inbounds i8*, i8** %0, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @fs_read(i8* %5, i8* %1, i32 8)
%7 = icmp eq i32 %6, 8
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.2, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %3
%12 = tail call i64 @keygen_getenv(i64* %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 -1)
unreachable
17: ; preds = %11
ret void
}