#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 /*<<< orphan*/ exeknow_error(int);
int /*<<< orphan*/ exeknow_get_details(int /*<<< orphan*/ *, int, char const *);
int exeknow_get_filetype(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
void exeknow_know(const char *fname) {
  FILE *fp = NULL;
  int ftype;
  if ((fp = fopen(fname, "rb")) == NULL)
    exeknow_error((-1));
  ftype = exeknow_get_filetype(fp);
  exeknow_get_details(fp, ftype, fname);
  fclose(fp);
}


x86 assembly (clang, -O0):
<exeknow_know>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    118c <exeknow_know+0x3c>
mov    $0xffffffff,%edi
call   1040 <exeknow_error@plt>
mov    -0x10(%rbp),%rdi
call   1050 <exeknow_get_filetype@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1060 <exeknow_get_details@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exeknow_know>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xea2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1175 <exeknow_know+0x25>
mov    $0xffffffff,%edi
call   1040 <exeknow_error@plt>
mov    %rbx,%rdi
call   1050 <exeknow_get_filetype@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1060 <exeknow_get_details@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define void @exeknow_know(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
store i32* null, i32** %3
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @exeknow_error(i32 -1)
br label %10
10: ; preds = %8, %1
%11 = load i32*, i32** %3
%12 = call i32 @exeknow_get_filetype(i32* %11)
store i32 %12, i32* %4
%13 = load i32*, i32** %3
%14 = load i32, i32* %4
%15 = load i8*, i8** %2
%16 = call i32 @exeknow_get_details(i32* %13, i32 %14, i8* %15)
%17 = load i32*, i32** %3
%18 = call i32 @fclose(i32* %17)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define void @exeknow_know(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @exeknow_error(i32 -1)
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @exeknow_get_filetype(i32* %2)
%8 = tail call i32 @exeknow_get_details(i32* %2, i32 %7, i8* %0)
%9 = tail call i32 @fclose(i32* %2)
ret void
}