#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 *);
int /*<<< orphan*/ order_tree_lbl(struct rooted_tree *);
struct rooted_tree *parse_tree();
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
struct rooted_tree *get_ordered_pattern_tree(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();
  if (!order_tree_lbl(pattern_tree)) {
    perror(NULL);
    exit(EXIT_FAILURE);
  }
  return pattern_tree;
}


x86 assembly (clang, -O0):
<get_ordered_pattern_tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <newick_scanner_set_string_input@plt>
mov    $0x0,%al
call   1050 <parse_tree@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    11df <get_ordered_pattern_tree+0x5f>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe40(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   10a0 <newick_scanner_clear_string_input@plt>
mov    -0x10(%rbp),%rdi
call   1030 <order_tree_lbl@plt>
cmp    $0x0,%eax
jne    120f <get_ordered_pattern_tree+0x8f>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <perror@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ordered_pattern_tree>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1070 <newick_scanner_set_string_input@plt>
xor    %eax,%eax
call   1050 <parse_tree@plt>
test   %rax,%rax
je     11b9 <get_ordered_pattern_tree+0x39>
mov    %rax,%rbx
xor    %eax,%eax
call   10a0 <newick_scanner_clear_string_input@plt>
mov    %rbx,%rdi
call   1030 <order_tree_lbl@plt>
test   %eax,%eax
je     11df <get_ordered_pattern_tree+0x5f>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
mov    %r14,%rdx
call   1060 <fprintf@plt>
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
jmp    11e6 <get_ordered_pattern_tree+0x66>
xor    %edi,%edi
call   1080 <perror@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
call   1090 <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_tree(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
%19 = call i32 @order_tree_lbl(%struct.rooted_tree* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %16
%22 = call i32 @perror(i32* null)
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %16
%26 = load %struct.rooted_tree*, %struct.rooted_tree** %3
ret %struct.rooted_tree* %26
}

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_tree(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()
%13 = tail call i32 @order_tree_lbl(%struct.rooted_tree* %3)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = tail call i32 @perror(i32* null)
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %11
ret %struct.rooted_tree* %3
}