#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 rooted_tree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ newick_scanner_clear_string_input();
int /*<<< orphan*/ newick_scanner_set_string_input(char *);
struct rooted_tree *parse_tree();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
struct rooted_tree *get_ordered_pattern_tree2(char *pattern) {
  struct rooted_tree *pattern_tree;
  newick_scanner_set_string_input(pattern);
  pattern_tree = parse_tree();
  if (NULL == pattern_tree) {
    fprintf(stderr, "Could not parse pattern tree '%s'\n", pattern);
    printf("\nError4");
    exit(EXIT_FAILURE);
  }
  newick_scanner_clear_string_input();
  return pattern_tree;
}


x86 assembly (clang, -O0):
<get_ordered_pattern_tree2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <newick_scanner_set_string_input@plt>
mov    $0x0,%al
call   1040 <parse_tree@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    11bf <get_ordered_pattern_tree2+0x5f>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe60(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1080 <newick_scanner_clear_string_input@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ordered_pattern_tree2>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1060 <newick_scanner_set_string_input@plt>
xor    %eax,%eax
call   1040 <parse_tree@plt>
test   %rax,%rax
je     118d <get_ordered_pattern_tree2+0x2d>
mov    %rax,%rbx
xor    %eax,%eax
call   1080 <newick_scanner_clear_string_input@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe63(%rip),%rsi
mov    %r14,%rdx
call   1050 <fprintf@plt>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.rooted_tree = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"Could not parse pattern tree '%s'\0A\00"
@.str.1 = [8 x i8] c"\0AError4\00"
@EXIT_FAILURE = global i32 0
define %struct.rooted_tree* @get_ordered_pattern_tree2(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.rooted_tree*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @newick_scanner_set_string_input(i8* %4)
%6 = call %struct.rooted_tree* (...) @parse_tree()
store %struct.rooted_tree* %6, %struct.rooted_tree** %3
%7 = load %struct.rooted_tree*, %struct.rooted_tree** %3
%8 = icmp eq %struct.rooted_tree* null, %7
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %2
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %1
%17 = call i32 (...) @newick_scanner_clear_string_input()
%18 = load %struct.rooted_tree*, %struct.rooted_tree** %3
ret %struct.rooted_tree* %18
}

LLVM IR (-O2):
%struct.rooted_tree = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"Could not parse pattern tree '%s'\0A\00"
@.str.1 = [8 x i8] c"\0AError4\00"
@EXIT_FAILURE = global i32 0
define %struct.rooted_tree* @get_ordered_pattern_tree2(i8* %0) {
%2 = tail call i32 @newick_scanner_set_string_input(i8* %0)
%3 = tail call %struct.rooted_tree* (...) @parse_tree()
%4 = icmp eq %struct.rooted_tree* %3, null
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = tail call i32 (...) @newick_scanner_clear_string_input()
ret %struct.rooted_tree* %3
}