#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 */
scalar_t__ parse_element(char **);
int /*<<< orphan*/ parse_misc(char **);
scalar_t__ parse_prolog(char **);
int /*<<< orphan*/ raiseEvent(char *, char *);
int parse_document(char **xml) {
  raiseEvent("startDocument", "");
  if (parse_prolog(xml))
    return 1;
  if (parse_element(xml))
    return 1;
  parse_misc(xml);
  raiseEvent("endDocument", "");
  return 0;
}


x86 assembly (clang, -O0):
<parse_document>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xead(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1050 <raiseEvent@plt>
mov    -0x10(%rbp),%rdi
call   1040 <parse_prolog@plt>
cmp    $0x0,%rax
je     117e <parse_document+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <parse_document+0x80>
mov    -0x10(%rbp),%rdi
call   1060 <parse_element@plt>
cmp    $0x0,%rax
je     119d <parse_document+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <parse_document+0x80>
mov    -0x10(%rbp),%rdi
call   1030 <parse_misc@plt>
lea    0xe61(%rip),%rdi
lea    0xe65(%rip),%rsi
call   1050 <raiseEvent@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_document>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb3(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1050 <raiseEvent@plt>
mov    %rbx,%rdi
call   1040 <parse_prolog@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1195 <parse_document+0x55>
mov    %rbx,%rdi
call   1060 <parse_element@plt>
test   %rax,%rax
jne    1195 <parse_document+0x55>
mov    %rbx,%rdi
call   1030 <parse_misc@plt>
lea    0xe87(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1050 <raiseEvent@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"startDocument\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [12 x i8] c"endDocument\00"
define i32 @parse_document(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = call i32 @raiseEvent(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8**, i8*** %3
%6 = call i64 @parse_prolog(i8** %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %18
9: ; preds = %1
%10 = load i8**, i8*** %3
%11 = call i64 @parse_element(i8** %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 1, i32* %2
br label %18
14: ; preds = %9
%15 = load i8**, i8*** %3
%16 = call i32 @parse_misc(i8** %15)
%17 = call i32 @raiseEvent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %18
18: ; preds = %14, %13, %8
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [14 x i8] c"startDocument\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [12 x i8] c"endDocument\00"
define i32 @parse_document(i8** %0) {
%2 = tail call i32 @raiseEvent(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i64 @parse_prolog(i8** %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = tail call i64 @parse_element(i8** %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 @parse_misc(i8** %0)
%10 = tail call i32 @raiseEvent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %5, %1, %8
%12 = phi i32 [ 0, %8 ], [ 1, %1 ], [ 1, %5 ]
ret i32 %12
}