#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*/ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ on_beg_tag(char *);
int /*<<< orphan*/ on_end_tag(char *, char *);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int /*<<< orphan*/);
int parseXml(FILE *f) {
  typedef enum {
    in_open_tag,
    in_close_tag,
    in_text,
  } state_t;
  typedef struct {
    int pos;
    char buf[2048];
    int no_text;
  } stack_frame;
  int line = 1;
  state_t state = in_text;
  char c = 0, last_c = 0;
  stack_frame stack[50];
  int level = 0;
  while (!feof(f)) {
    last_c = c;
    c = fgetc(f);
    if (c == '\r' || c == '\n') {
      if (last_c != '\r' && last_c != '\n')
        line++;
      continue;
    }
    switch (state) {
    case in_open_tag:
      if (c == '>') {
        on_beg_tag(stack[level].buf);
        state = in_text;
        if (stack[level].no_text) {
          level--;
          continue;
        }
        level++;
        stack[level].pos = 0;
        stack[level].buf[0] = 0;
        continue;
      }
      if (c == '/' && last_c == '<') {
        state = in_close_tag;
        continue;
      }
      if (c == '/') {
        stack[level].no_text = 1;
        continue;
      }
      stack[level].buf[stack[level].pos++] = c;
      stack[level].buf[stack[level].pos] = 0;
      break;
    case in_close_tag:
      if (c == '>') {
        state = in_text;
        if (strncmp(stack[level].buf, stack[level - 2].buf,
                    strlen(stack[level].buf)) != 0) {
          printf("Error with '%s', line %d\n", stack[level].buf, line);
          return -1;
        }
        level -= 3;
        on_end_tag(stack[level + 3].buf, stack[level + 2].buf);
        continue;
      }
      stack[level].buf[stack[level].pos++] = c;
      stack[level].buf[stack[level].pos] = 0;
      break;
    case in_text:
      if (c == '<') {
        state = in_open_tag;
        level++;
        stack[level].pos = 0;
        stack[level].buf[0] = 0;
        stack[level].no_text = 0;
        continue;
      }
      stack[level].buf[stack[level].pos++] = c;
      stack[level].buf[stack[level].pos] = 0;
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<parseXml>:
push   %rbp
mov    %rsp,%rbp
sub    $0x191d0,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
movb   $0x0,-0x1a(%rbp)
movl   $0x0,-0x191b4(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11bd <parseXml+0x4d>
jmp    1697 <parseXml+0x527>
mov    -0x19(%rbp),%al
mov    %al,-0x1a(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0xd,%eax
je     11e9 <parseXml+0x79>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    1211 <parseXml+0xa1>
movsbl -0x1a(%rbp),%eax
cmp    $0xd,%eax
je     120c <parseXml+0x9c>
movsbl -0x1a(%rbp),%eax
cmp    $0xa,%eax
je     120c <parseXml+0x9c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119f <parseXml+0x2f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x191b8(%rbp)
test   %eax,%eax
je     124f <parseXml+0xdf>
jmp    1227 <parseXml+0xb7>
mov    -0x191b8(%rbp),%eax
sub    $0x1,%eax
je     13e5 <parseXml+0x275>
jmp    123b <parseXml+0xcb>
mov    -0x191b8(%rbp),%eax
sub    $0x2,%eax
je     1593 <parseXml+0x423>
jmp    1692 <parseXml+0x522>
movsbl -0x19(%rbp),%eax
cmp    $0x3e,%eax
jne    130b <parseXml+0x19b>
movslq -0x191b4(%rbp),%rax
lea    -0x191b0(%rbp),%rdi
imul   $0x808,%rax,%rax
add    %rax,%rdi
add    $0x4,%rdi
call   1080 <on_beg_tag@plt>
movl   $0x2,-0x18(%rbp)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x0,0x804(%rax)
je     12bd <parseXml+0x14d>
mov    -0x191b4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x191b4(%rbp)
jmp    119f <parseXml+0x2f>
mov    -0x191b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x191b4(%rbp)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movl   $0x0,(%rax)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x4(%rax)
jmp    119f <parseXml+0x2f>
movsbl -0x19(%rbp),%eax
cmp    $0x2f,%eax
jne    1331 <parseXml+0x1c1>
movsbl -0x1a(%rbp),%eax
cmp    $0x3c,%eax
jne    1331 <parseXml+0x1c1>
movl   $0x1,-0x18(%rbp)
jmp    119f <parseXml+0x2f>
movsbl -0x19(%rbp),%eax
cmp    $0x2f,%eax
jne    1365 <parseXml+0x1f5>
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movl   $0x1,0x804(%rax)
jmp    119f <parseXml+0x2f>
mov    -0x19(%rbp),%dl
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rsi
imul   $0x808,%rcx,%rcx
add    %rcx,%rsi
mov    (%rsi),%ecx
mov    %ecx,%edi
add    $0x1,%edi
mov    %edi,(%rsi)
movslq %ecx,%rcx
mov    %dl,0x4(%rax,%rcx,1)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movslq -0x191b4(%rbp),%rdx
lea    -0x191b0(%rbp),%rcx
imul   $0x808,%rdx,%rdx
add    %rdx,%rcx
movslq (%rcx),%rcx
movb   $0x0,0x4(%rax,%rcx,1)
jmp    1692 <parseXml+0x522>
movsbl -0x19(%rbp),%eax
cmp    $0x3e,%eax
jne    1513 <parseXml+0x3a3>
movl   $0x2,-0x18(%rbp)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
add    $0x4,%rax
mov    %rax,-0x191c8(%rbp)
mov    -0x191b4(%rbp),%eax
sub    $0x2,%eax
movslq %eax,%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
add    $0x4,%rax
mov    %rax,-0x191c0(%rbp)
movslq -0x191b4(%rbp),%rax
lea    -0x191b0(%rbp),%rdi
imul   $0x808,%rax,%rax
add    %rax,%rdi
add    $0x4,%rdi
call   1040 <strlen@plt>
mov    -0x191c8(%rbp),%rdi
mov    -0x191c0(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     14ba <parseXml+0x34a>
movslq -0x191b4(%rbp),%rax
lea    -0x191b0(%rbp),%rsi
imul   $0x808,%rax,%rax
add    %rax,%rsi
add    $0x4,%rsi
mov    -0x14(%rbp),%edx
lea    0xb57(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    169e <parseXml+0x52e>
mov    -0x191b4(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x191b4(%rbp)
mov    -0x191b4(%rbp),%eax
add    $0x3,%eax
cltq
lea    -0x191b0(%rbp),%rdi
imul   $0x808,%rax,%rax
add    %rax,%rdi
add    $0x4,%rdi
mov    -0x191b4(%rbp),%eax
add    $0x2,%eax
cltq
lea    -0x191b0(%rbp),%rsi
imul   $0x808,%rax,%rax
add    %rax,%rsi
add    $0x4,%rsi
call   1090 <on_end_tag@plt>
jmp    119f <parseXml+0x2f>
mov    -0x19(%rbp),%dl
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rsi
imul   $0x808,%rcx,%rcx
add    %rcx,%rsi
mov    (%rsi),%ecx
mov    %ecx,%edi
add    $0x1,%edi
mov    %edi,(%rsi)
movslq %ecx,%rcx
mov    %dl,0x4(%rax,%rcx,1)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movslq -0x191b4(%rbp),%rdx
lea    -0x191b0(%rbp),%rcx
imul   $0x808,%rdx,%rdx
add    %rdx,%rcx
movslq (%rcx),%rcx
movb   $0x0,0x4(%rax,%rcx,1)
jmp    1692 <parseXml+0x522>
movsbl -0x19(%rbp),%eax
cmp    $0x3c,%eax
jne    1617 <parseXml+0x4a7>
movl   $0x0,-0x18(%rbp)
mov    -0x191b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x191b4(%rbp)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movl   $0x0,(%rax)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x4(%rax)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movl   $0x0,0x804(%rax)
jmp    119f <parseXml+0x2f>
mov    -0x19(%rbp),%dl
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rsi
imul   $0x808,%rcx,%rcx
add    %rcx,%rsi
mov    (%rsi),%ecx
mov    %ecx,%edi
add    $0x1,%edi
mov    %edi,(%rsi)
movslq %ecx,%rcx
mov    %dl,0x4(%rax,%rcx,1)
movslq -0x191b4(%rbp),%rcx
lea    -0x191b0(%rbp),%rax
imul   $0x808,%rcx,%rcx
add    %rcx,%rax
movslq -0x191b4(%rbp),%rdx
lea    -0x191b0(%rbp),%rcx
imul   $0x808,%rdx,%rdx
add    %rdx,%rcx
movslq (%rcx),%rcx
movb   $0x0,0x4(%rax,%rcx,1)
jmp    119f <parseXml+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x191d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseXml>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x19198,%rsp
mov    %rdi,%r14
call   1070 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    13f2 <parseXml+0x282>
mov    $0x1,%r12d
mov    $0x2,%r15d
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    11f0 <parseXml+0x80>
add    $0x1,%r13d
movslq %r13d,%rax
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rax
movl   $0x0,(%rsp,%rax,1)
movb   $0x0,0x4(%rsp,%rax,1)
movl   $0x0,0x804(%rsp,%rax,1)
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    13f0 <parseXml+0x280>
mov    %ebp,%ebx
mov    %r14,%rdi
call   1060 <fgetc@plt>
mov    %eax,%ebp
cmp    $0xd,%al
je     1206 <parseXml+0x96>
cmp    $0xa,%bpl
jne    1220 <parseXml+0xb0>
cmp    $0xa,%bl
je     11e0 <parseXml+0x70>
cmp    $0xd,%bl
je     11e0 <parseXml+0x70>
add    $0x1,%r12d
jmp    11e0 <parseXml+0x70>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x2,%r15d
je     126d <parseXml+0xfd>
cmp    $0x1,%r15d
je     12a6 <parseXml+0x136>
test   %r15d,%r15d
jne    11e0 <parseXml+0x70>
cmp    $0x3e,%bpl
jne    1335 <parseXml+0x1c5>
movslq %r13d,%rax
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rbx
lea    (%rsp,%rbx,1),%rdi
add    $0x4,%rdi
call   1080 <on_beg_tag@plt>
cmpl   $0x0,0x804(%rsp,%rbx,1)
je     13a3 <parseXml+0x233>
add    $0xffffffff,%r13d
jmp    13c1 <parseXml+0x251>
cmp    $0x3c,%bpl
je     11a8 <parseXml+0x38>
movslq %r13d,%rax
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rax
lea    (%rsp,%rax,1),%rcx
movslq (%rsp,%rax,1),%rdx
lea    0x1(%rdx),%esi
mov    %esi,(%rsp,%rax,1)
mov    %bpl,0x4(%rdx,%rcx,1)
movslq (%rsp,%rax,1),%rax
movb   $0x0,0x4(%rax,%rcx,1)
jmp    13c1 <parseXml+0x251>
movslq %r13d,%rax
cmp    $0x3e,%bpl
jne    1371 <parseXml+0x201>
mov    %r12d,%ebx
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rcx
lea    (%rsp,%rcx,1),%r15
add    $0x4,%r15
lea    -0x2(%rax),%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rax
add    $0xfffffffffffffff0,%rax
lea    (%rsp,%rax,1),%r12
add    $0x4,%r12
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    1404 <parseXml+0x294>
lea    -0x3(%r13),%r12d
add    $0xffffffff,%r13d
movslq %r13d,%rax
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rax
lea    (%rsp,%rax,1),%rsi
add    $0x4,%rsi
mov    %r15,%rdi
call   1090 <on_end_tag@plt>
mov    $0x2,%r15d
mov    %r12d,%r13d
mov    %ebx,%r12d
jmp    11e0 <parseXml+0x70>
cmp    $0x3c,%bl
jne    134a <parseXml+0x1da>
mov    $0x1,%r15d
cmp    $0x2f,%bpl
je     11e0 <parseXml+0x70>
movslq %r13d,%rax
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rax
cmp    $0x2f,%bpl
jne    13cc <parseXml+0x25c>
movl   $0x1,0x804(%rsp,%rax,1)
xor    %r15d,%r15d
jmp    11e0 <parseXml+0x70>
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rax
lea    (%rsp,%rax,1),%rcx
movslq (%rsp,%rax,1),%rdx
lea    0x1(%rdx),%esi
mov    %esi,(%rsp,%rax,1)
mov    %bpl,0x4(%rdx,%rcx,1)
movslq (%rsp,%rax,1),%rax
movb   $0x0,0x4(%rax,%rcx,1)
mov    $0x1,%r15d
jmp    11e0 <parseXml+0x70>
add    $0x1,%r13d
movslq %r13d,%rax
mov    %rax,%rcx
shl    $0xb,%rcx
lea    (%rcx,%rax,8),%rax
movl   $0x0,(%rsp,%rax,1)
movb   $0x0,0x4(%rsp,%rax,1)
mov    $0x2,%r15d
jmp    11e0 <parseXml+0x70>
lea    (%rsp,%rax,1),%rcx
movslq (%rsp,%rax,1),%rdx
lea    0x1(%rdx),%esi
mov    %esi,(%rsp,%rax,1)
mov    %bpl,0x4(%rdx,%rcx,1)
movslq (%rsp,%rax,1),%rax
movb   $0x0,0x4(%rax,%rcx,1)
xor    %r15d,%r15d
jmp    11e0 <parseXml+0x70>
xor    %eax,%eax
add    $0x19198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbf5(%rip),%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1050 <printf@plt>
mov    $0xffffffff,%eax
jmp    13f2 <parseXml+0x282>

LLVM IR (-O0):
%struct.stack_frame = type { i32, [2048 x i8], i32 }
@.str = [26 x i8] c"Error with '%s', line %d\0A\00"
define i32 @parseXml(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca [50 x %struct.stack_frame]
%9 = alloca i32
store i32* %0, i32** %3
store i32 1, i32* %4
store i32 2, i32* %5
store i8 0, i8* %6
store i8 0, i8* %7
store i32 0, i32* %9
br label %10
10: ; preds = %233, %192, %147, %85, %80, %60, %57, %37, %1
%11 = load i32*, i32** %3
%12 = call i32 @feof(i32* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %234
15: ; preds = %10
%16 = load i8, i8* %6
store i8 %16, i8* %7
%17 = load i32*, i32** %3
%18 = call signext i8 @fgetc(i32* %17)
store i8 %18, i8* %6
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 13
br i1 %21, label %26, label %22
22: ; preds = %15
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 10
br i1 %25, label %26, label %38
26: ; preds = %22, %15
%27 = load i8, i8* %7
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 13
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i8, i8* %7
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 10
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %37
37: ; preds = %34, %30, %26
br label %10
38: ; preds = %22
%39 = load i32, i32* %5
switch i32 %39, label %233 [
i32 0, label %40
i32 1, label %115
i32 2, label %188
]
40: ; preds = %38
%41 = load i8, i8* %6
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 62
br i1 %43, label %44, label %72
44: ; preds = %40
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %46
%48 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %47, i32 0, i32 1
%49 = getelementptr inbounds [2048 x i8], [2048 x i8]* %48, i64 0, i64 0
%50 = call i32 @on_beg_tag(i8* %49)
store i32 2, i32* %5
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %52
%54 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %53, i32 0, i32 2
%55 = load i32, i32* %54
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %44
%58 = load i32, i32* %9
%59 = add nsw i32 %58, -1
store i32 %59, i32* %9
br label %10
60: ; preds = %44
%61 = load i32, i32* %9
%62 = add nsw i32 %61, 1
store i32 %62, i32* %9
%63 = load i32, i32* %9
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %64
%66 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %65, i32 0, i32 0
store i32 0, i32* %66
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %68
%70 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %69, i32 0, i32 1
%71 = getelementptr inbounds [2048 x i8], [2048 x i8]* %70, i64 0, i64 0
store i8 0, i8* %71
br label %10
72: ; preds = %40
%73 = load i8, i8* %6
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 47
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = load i8, i8* %7
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 60
br i1 %79, label %80, label %81
80: ; preds = %76
store i32 1, i32* %5
br label %10
81: ; preds = %76, %72
%82 = load i8, i8* %6
%83 = sext i8 %82 to i32
%84 = icmp eq i32 %83, 47
br i1 %84, label %85, label %90
85: ; preds = %81
%86 = load i32, i32* %9
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %87
%89 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %88, i32 0, i32 2
store i32 1, i32* %89
br label %10
90: ; preds = %81
%91 = load i8, i8* %6
%92 = load i32, i32* %9
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %93
%95 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %94, i32 0, i32 1
%96 = load i32, i32* %9
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %97
%99 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %98, i32 0, i32 0
%100 = load i32, i32* %99
%101 = add nsw i32 %100, 1
store i32 %101, i32* %99
%102 = sext i32 %100 to i64
%103 = getelementptr inbounds [2048 x i8], [2048 x i8]* %95, i64 0, i64 %102
store i8 %91, i8* %103
%104 = load i32, i32* %9
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %105
%107 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %106, i32 0, i32 1
%108 = load i32, i32* %9
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %109
%111 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %110, i32 0, i32 0
%112 = load i32, i32* %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [2048 x i8], [2048 x i8]* %107, i64 0, i64 %113
store i8 0, i8* %114
br label %233
115: ; preds = %38
%116 = load i8, i8* %6
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 62
br i1 %118, label %119, label %163
119: ; preds = %115
store i32 2, i32* %5
%120 = load i32, i32* %9
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %121
%123 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %122, i32 0, i32 1
%124 = getelementptr inbounds [2048 x i8], [2048 x i8]* %123, i64 0, i64 0
%125 = load i32, i32* %9
%126 = sub nsw i32 %125, 2
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %127
%129 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %128, i32 0, i32 1
%130 = getelementptr inbounds [2048 x i8], [2048 x i8]* %129, i64 0, i64 0
%131 = load i32, i32* %9
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %132
%134 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %133, i32 0, i32 1
%135 = getelementptr inbounds [2048 x i8], [2048 x i8]* %134, i64 0, i64 0
%136 = call i32 @strlen(i8* %135)
%137 = call i32 @strncmp(i8* %124, i8* %130, i32 %136)
%138 = icmp ne i32 %137, 0
br i1 %138, label %139, label %147
139: ; preds = %119
%140 = load i32, i32* %9
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %141
%143 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %142, i32 0, i32 1
%144 = getelementptr inbounds [2048 x i8], [2048 x i8]* %143, i64 0, i64 0
%145 = load i32, i32* %4
%146 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %144, i32 %145)
store i32 -1, i32* %2
br label %235
147: ; preds = %119
%148 = load i32, i32* %9
%149 = sub nsw i32 %148, 3
store i32 %149, i32* %9
%150 = load i32, i32* %9
%151 = add nsw i32 %150, 3
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %152
%154 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %153, i32 0, i32 1
%155 = getelementptr inbounds [2048 x i8], [2048 x i8]* %154, i64 0, i64 0
%156 = load i32, i32* %9
%157 = add nsw i32 %156, 2
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %158
%160 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %159, i32 0, i32 1
%161 = getelementptr inbounds [2048 x i8], [2048 x i8]* %160, i64 0, i64 0
%162 = call i32 @on_end_tag(i8* %155, i8* %161)
br label %10
163: ; preds = %115
%164 = load i8, i8* %6
%165 = load i32, i32* %9
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %166
%168 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %167, i32 0, i32 1
%169 = load i32, i32* %9
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %170
%172 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %171, i32 0, i32 0
%173 = load i32, i32* %172
%174 = add nsw i32 %173, 1
store i32 %174, i32* %172
%175 = sext i32 %173 to i64
%176 = getelementptr inbounds [2048 x i8], [2048 x i8]* %168, i64 0, i64 %175
store i8 %164, i8* %176
%177 = load i32, i32* %9
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %178
%180 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %179, i32 0, i32 1
%181 = load i32, i32* %9
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %182
%184 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %183, i32 0, i32 0
%185 = load i32, i32* %184
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds [2048 x i8], [2048 x i8]* %180, i64 0, i64 %186
store i8 0, i8* %187
br label %233
188: ; preds = %38
%189 = load i8, i8* %6
%190 = sext i8 %189 to i32
%191 = icmp eq i32 %190, 60
br i1 %191, label %192, label %208
192: ; preds = %188
store i32 0, i32* %5
%193 = load i32, i32* %9
%194 = add nsw i32 %193, 1
store i32 %194, i32* %9
%195 = load i32, i32* %9
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %196
%198 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %197, i32 0, i32 0
store i32 0, i32* %198
%199 = load i32, i32* %9
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %200
%202 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %201, i32 0, i32 1
%203 = getelementptr inbounds [2048 x i8], [2048 x i8]* %202, i64 0, i64 0
store i8 0, i8* %203
%204 = load i32, i32* %9
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %205
%207 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %206, i32 0, i32 2
store i32 0, i32* %207
br label %10
208: ; preds = %188
%209 = load i8, i8* %6
%210 = load i32, i32* %9
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %211
%213 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %212, i32 0, i32 1
%214 = load i32, i32* %9
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %215
%217 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %216, i32 0, i32 0
%218 = load i32, i32* %217
%219 = add nsw i32 %218, 1
store i32 %219, i32* %217
%220 = sext i32 %218 to i64
%221 = getelementptr inbounds [2048 x i8], [2048 x i8]* %213, i64 0, i64 %220
store i8 %209, i8* %221
%222 = load i32, i32* %9
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %223
%225 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %224, i32 0, i32 1
%226 = load i32, i32* %9
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %8, i64 0, i64 %227
%229 = getelementptr inbounds %struct.stack_frame, %struct.stack_frame* %228, i32 0, i32 0
%230 = load i32, i32* %229
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds [2048 x i8], [2048 x i8]* %225, i64 0, i64 %231
store i8 0, i8* %232
br label %233
233: ; preds = %38, %208, %163, %90
br label %10
234: ; preds = %10
store i32 0, i32* %2
br label %235
235: ; preds = %234, %139
%236 = load i32, i32* %2
ret i32 %236
}

LLVM IR (-O2):
%struct.stack_frame = type { i32, [2048 x i8], i32 }
@.str = [26 x i8] c"Error with '%s', line %d\0A\00"
define i32 @parseXml(i32* nocapture %0) {
%2 = alloca [50 x %struct.stack_frame]
%3 = bitcast [50 x %struct.stack_frame]* %2 to i8*
%4 = call i32 @feof(i32* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %101
6: ; preds = %1, %15
%7 = phi i32 [ %18, %15 ], [ 0, %1 ]
%8 = phi i8 [ %11, %15 ], [ 0, %1 ]
%9 = phi i32 [ %17, %15 ], [ 2, %1 ]
%10 = phi i32 [ %16, %15 ], [ 1, %1 ]
%11 = call signext i8 @fgetc(i32* %0)
switch i8 %11, label %21 [
i8 13, label %12
i8 10, label %12
]
12: ; preds = %6, %6
switch i8 %8, label %13 [
i8 13, label %15
i8 10, label %15
]
13: ; preds = %12
%14 = add nsw i32 %10, 1
br label %15
15: ; preds = %46, %74, %91, %21, %13, %12, %12, %31, %33, %44, %68, %85, %38
%16 = phi i32 [ %10, %85 ], [ %10, %68 ], [ %10, %31 ], [ %10, %33 ], [ %10, %44 ], [ %10, %38 ], [ %14, %13 ], [ %10, %12 ], [ %10, %12 ], [ %10, %21 ], [ %10, %91 ], [ %10, %74 ], [ %10, %46 ]
%17 = phi i32 [ 0, %85 ], [ 2, %68 ], [ 2, %31 ], [ 2, %33 ], [ 0, %44 ], [ 1, %38 ], [ %9, %13 ], [ %9, %12 ], [ %9, %12 ], [ %9, %21 ], [ 2, %91 ], [ 1, %74 ], [ 0, %46 ]
%18 = phi i32 [ %86, %85 ], [ %69, %68 ], [ %32, %31 ], [ %34, %33 ], [ %7, %44 ], [ %7, %38 ], [ %7, %13 ], [ %7, %12 ], [ %7, %12 ], [ %7, %21 ], [ %7, %91 ], [ %7, %74 ], [ %7, %46 ]
%19 = call i32 @feof(i32* %0)
%20 = icmp eq i32 %19, 0
br i1 %20, label %6, label %101
21: ; preds = %6
switch i32 %9, label %15 [
i32 0, label %22
i32 1, label %55
i32 2, label %83
]
22: ; preds = %21
%23 = icmp eq i8 %11, 62
br i1 %23, label %24, label %38
24: ; preds = %22
%25 = sext i32 %7 to i64
%26 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %25, i32 1, i64 0
%27 = call i32 @on_beg_tag(i8* %26)
%28 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %25, i32 2
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %24
%32 = add nsw i32 %7, -1
br label %15
33: ; preds = %24
%34 = add nsw i32 %7, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %35, i32 0
store i32 0, i32* %36
%37 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %35, i32 1, i64 0
store i8 0, i8* %37
br label %15
38: ; preds = %22
%39 = icmp eq i8 %11, 47
%40 = icmp eq i8 %8, 60
%41 = and i1 %40, %39
br i1 %41, label %15, label %42
42: ; preds = %38
%43 = sext i32 %7 to i64
br i1 %39, label %44, label %46
44: ; preds = %42
%45 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %43, i32 2
store i32 1, i32* %45
br label %15
46: ; preds = %42
%47 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %43, i32 0
%48 = load i32, i32* %47
%49 = add nsw i32 %48, 1
store i32 %49, i32* %47
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %43, i32 1, i64 %50
store i8 %11, i8* %51
%52 = load i32, i32* %47
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %43, i32 1, i64 %53
store i8 0, i8* %54
br label %15
55: ; preds = %21
%56 = icmp eq i8 %11, 62
%57 = sext i32 %7 to i64
br i1 %56, label %58, label %74
58: ; preds = %55
%59 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %57, i32 1, i64 0
%60 = add nsw i32 %7, -2
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %61, i32 1, i64 0
%63 = call i32 @strlen(i8* %59)
%64 = call i32 @strncmp(i8* %59, i8* %62, i32 %63)
%65 = icmp eq i32 %64, 0
br i1 %65, label %68, label %66
66: ; preds = %58
%67 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %59, i32 %10)
br label %101
68: ; preds = %58
%69 = add nsw i32 %7, -3
%70 = add nsw i32 %7, -1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %71, i32 1, i64 0
%73 = call i32 @on_end_tag(i8* %59, i8* %72)
br label %15
74: ; preds = %55
%75 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %57, i32 0
%76 = load i32, i32* %75
%77 = add nsw i32 %76, 1
store i32 %77, i32* %75
%78 = sext i32 %76 to i64
%79 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %57, i32 1, i64 %78
store i8 %11, i8* %79
%80 = load i32, i32* %75
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %57, i32 1, i64 %81
store i8 0, i8* %82
br label %15
83: ; preds = %21
%84 = icmp eq i8 %11, 60
br i1 %84, label %85, label %91
85: ; preds = %83
%86 = add nsw i32 %7, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %87, i32 0
store i32 0, i32* %88
%89 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %87, i32 1, i64 0
store i8 0, i8* %89
%90 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %87, i32 2
store i32 0, i32* %90
br label %15
91: ; preds = %83
%92 = sext i32 %7 to i64
%93 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %92, i32 0
%94 = load i32, i32* %93
%95 = add nsw i32 %94, 1
store i32 %95, i32* %93
%96 = sext i32 %94 to i64
%97 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %92, i32 1, i64 %96
store i8 %11, i8* %97
%98 = load i32, i32* %93
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [50 x %struct.stack_frame], [50 x %struct.stack_frame]* %2, i64 0, i64 %92, i32 1, i64 %99
store i8 0, i8* %100
br label %15
101: ; preds = %15, %1, %66
%102 = phi i32 [ -1, %66 ], [ 0, %1 ], [ 0, %15 ]
ret i32 %102
}