#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 */
struct hmm_struc {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ Die(char *, ...);
struct hmm_struc *ReadHMM(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
struct hmm_struc *start_from_hmm(char *hmmfile) {
  struct hmm_struc *hmm;
  FILE *hmmfp;
  if ((hmmfp = fopen(hmmfile, "rb")) == NULL)
    Die("Error: failed to open HMM file %s for reading.\n");
  if ((hmm = ReadHMM(hmmfp)) == NULL)
    Die("Error: failed to parse HMM file %s\n", hmmfile);
  fclose(hmmfp);
  return hmm;
}


x86 assembly (clang, -O0):
<start_from_hmm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1178 <start_from_hmm+0x38>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <Die@plt>
mov    -0x18(%rbp),%rdi
call   1050 <ReadHMM@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11a1 <start_from_hmm+0x61>
mov    -0x8(%rbp),%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <Die@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_from_hmm>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xeb1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    116a <start_from_hmm+0x2a>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <Die@plt>
mov    %r15,%rdi
call   1050 <ReadHMM@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    118b <start_from_hmm+0x4b>
lea    0xeb2(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <Die@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.hmm_struc = type { i32 }
@.str = [3 x i8] c"rb\00"
@.str.1 = [48 x i8] c"Error: failed to open HMM file %s for reading.\0A\00"
@.str.2 = [36 x i8] c"Error: failed to parse HMM file %s\0A\00"
define %struct.hmm_struc* @start_from_hmm(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.hmm_struc*
%4 = alloca i32*
store i8* %0, i8** %2
%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** %4
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) @Die(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i32*, i32** %4
%12 = call %struct.hmm_struc* @ReadHMM(i32* %11)
store %struct.hmm_struc* %12, %struct.hmm_struc** %3
%13 = icmp eq %struct.hmm_struc* %12, null
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i8*, i8** %2
%16 = call i32 (i8*, ...) @Die(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %10
%18 = load i32*, i32** %4
%19 = call i32 @fclose(i32* %18)
%20 = load %struct.hmm_struc*, %struct.hmm_struc** %3
ret %struct.hmm_struc* %20
}

LLVM IR (-O2):
%struct.hmm_struc = type { i32 }
@.str = [3 x i8] c"rb\00"
@.str.1 = [48 x i8] c"Error: failed to open HMM file %s for reading.\0A\00"
@.str.2 = [36 x i8] c"Error: failed to parse HMM file %s\0A\00"
define %struct.hmm_struc* @start_from_hmm(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 (i8*, ...) @Die(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call %struct.hmm_struc* @ReadHMM(i32* %2)
%8 = icmp eq %struct.hmm_struc* %7, null
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 (i8*, ...) @Die(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %11
11: ; preds = %9, %6
%12 = tail call i32 @fclose(i32* %2)
ret %struct.hmm_struc* %7
}