#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 szl_obj {
  int dummy;
};
struct szl_interp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strndup(char const *, size_t const);
int /*<<< orphan*/ szl_free(struct szl_obj *);
scalar_t__ szl_isspace(char);
int /*<<< orphan*/ szl_list_append(struct szl_interp *, struct szl_obj *,
                                   struct szl_obj *);
struct szl_obj *szl_new_list(struct szl_interp *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/);
struct szl_obj *szl_new_str(struct szl_interp *, char *, int);
int /*<<< orphan*/ szl_set_last_fmt(struct szl_interp *, char const *,
                                    char const *);
int /*<<< orphan*/ szl_unref(struct szl_obj *);
__attribute__((nonnull(1, 2))) struct szl_obj *
szl_parse_stmts(struct szl_interp *interp, const char *buf, const size_t len) {
  struct szl_obj *stmts, *stmt;
  char *copy, *line, *next = NULL;
  const char *fmt = NULL;
  size_t i = 0;
  int nbraces = 0, nbrackets = 0;
  copy = strndup(buf, len);
  if (!copy)
    return NULL;
  stmts = szl_new_list(interp, NULL, 0);
  if (!stmts) {
    free(copy);
    return stmts;
  }
  line = copy;
  while (i < len) {
    if (copy[i] == '{')
      ++nbraces;
    else if (copy[i] == '}')
      --nbraces;
    else if (copy[i] == '[')
      ++nbrackets;
    else if (copy[i] == ']')
      --nbrackets;
    if (i == len - 1) {
      if (nbraces != 0)
        fmt = "unbalanced {}: %s\n";
      else if (nbrackets != 0)
        fmt = "unbalanced []: %s\n";
      if (fmt) {
        szl_set_last_fmt(interp, fmt, buf);
        szl_free(stmts);
        free(copy);
        return NULL;
      }
    } else if ((copy[i] != '\n') || (nbraces != 0) || (nbrackets != 0)) {
      ++i;
      continue;
    }
    if (copy[i] == '\n')
      copy[i] = '\0';
    next = &copy[i + 1];
    for (; szl_isspace(*line); ++line)
      ;
    if (line[0] != '\0' && line[0] != '#') {
      stmt = szl_new_str(interp, line, next - line);
      if (!stmt) {
        szl_free(stmts);
        free(copy);
        return NULL;
      }
      if (!szl_list_append(interp, stmts, stmt)) {
        szl_free(stmt);
        szl_free(stmts);
        free(copy);
        return NULL;
      }
      szl_unref(stmt);
    }
    line = next;
    ++i;
  }
  free(copy);
  return stmts;
}


x86 assembly (clang, -O0):
<szl_parse_stmts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strndup@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11f3 <szl_parse_stmts+0x63>
movq   $0x0,-0x8(%rbp)
jmp    14d8 <szl_parse_stmts+0x348>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <szl_new_list@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1227 <szl_parse_stmts+0x97>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    14d8 <szl_parse_stmts+0x348>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x58(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    14c7 <szl_parse_stmts+0x337>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7b,%eax
jne    1260 <szl_parse_stmts+0xd0>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    12d3 <szl_parse_stmts+0x143>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7d,%eax
jne    1283 <szl_parse_stmts+0xf3>
mov    -0x5c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x5c(%rbp)
jmp    12ce <szl_parse_stmts+0x13e>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5b,%eax
jne    12a6 <szl_parse_stmts+0x116>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    12c9 <szl_parse_stmts+0x139>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5d,%eax
jne    12c4 <szl_parse_stmts+0x134>
mov    -0x60(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x60(%rbp)
jmp    12c9 <szl_parse_stmts+0x139>
jmp    12ce <szl_parse_stmts+0x13e>
jmp    12d3 <szl_parse_stmts+0x143>
mov    -0x58(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jne    135c <szl_parse_stmts+0x1cc>
cmpl   $0x0,-0x5c(%rbp)
je     1302 <szl_parse_stmts+0x172>
lea    0xd07(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    131c <szl_parse_stmts+0x18c>
cmpl   $0x0,-0x60(%rbp)
je     1317 <szl_parse_stmts+0x187>
lea    0xd00(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    131c <szl_parse_stmts+0x18c>
cmpq   $0x0,-0x50(%rbp)
je     1357 <szl_parse_stmts+0x1c7>
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1070 <szl_set_last_fmt@plt>
mov    -0x28(%rbp),%rdi
call   1040 <szl_free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    14d8 <szl_parse_stmts+0x348>
jmp    139b <szl_parse_stmts+0x20b>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1385 <szl_parse_stmts+0x1f5>
cmpl   $0x0,-0x5c(%rbp)
jne    1385 <szl_parse_stmts+0x1f5>
cmpl   $0x0,-0x60(%rbp)
je     1396 <szl_parse_stmts+0x206>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    122f <szl_parse_stmts+0x9f>
jmp    139b <szl_parse_stmts+0x20b>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    13bc <szl_parse_stmts+0x22c>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%rcx
add    $0x1,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%edi
call   1090 <szl_isspace@plt>
cmp    $0x0,%rax
je     13fb <szl_parse_stmts+0x26b>
jmp    13ea <szl_parse_stmts+0x25a>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    13cf <szl_parse_stmts+0x23f>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     14ae <szl_parse_stmts+0x31e>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     14ae <szl_parse_stmts+0x31e>
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1080 <szl_new_str@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1463 <szl_parse_stmts+0x2d3>
mov    -0x28(%rbp),%rdi
call   1040 <szl_free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    14d8 <szl_parse_stmts+0x348>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   10a0 <szl_list_append@plt>
cmp    $0x0,%eax
jne    14a5 <szl_parse_stmts+0x315>
mov    -0x30(%rbp),%rdi
call   1040 <szl_free@plt>
mov    -0x28(%rbp),%rdi
call   1040 <szl_free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    14d8 <szl_parse_stmts+0x348>
mov    -0x30(%rbp),%rdi
call   10b0 <szl_unref@plt>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    122f <szl_parse_stmts+0x9f>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<szl_parse_stmts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1060 <strndup@plt>
test   %rax,%rax
je     1363 <szl_parse_stmts+0x1d3>
mov    %rax,%r13
xor    %ebp,%ebp
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <szl_new_list@plt>
test   %rax,%rax
je     1371 <szl_parse_stmts+0x1e1>
test   %r14,%r14
je     136e <szl_parse_stmts+0x1de>
mov    %rax,0x8(%rsp)
mov    %r15,(%rsp)
mov    %rbx,0x10(%rsp)
lea    -0x1(%r14),%r15
lea    0x1(%r13),%rax
mov    %rax,0x18(%rsp)
xor    %ebp,%ebp
lea    0xdfe(%rip),%rbx
mov    %r13,%rax
jmp    1224 <szl_parse_stmts+0x94>
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rbp
mov    %r13,%rax
add    %rbp,%rax
cmp    %r14,%rbp
jae    1367 <szl_parse_stmts+0x1d7>
xor    %ecx,%ecx
xor    %edx,%edx
jmp    123d <szl_parse_stmts+0xad>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %r14,%rbp
jae    1367 <szl_parse_stmts+0x1d7>
movzbl 0x0(%r13,%rbp,1),%esi
lea    -0x5b(%rsi),%edi
cmp    $0x22,%dil
ja     1290 <szl_parse_stmts+0x100>
movzbl %dil,%edi
movslq (%rbx,%rdi,4),%rdi
add    %rbx,%rdi
jmp    *%rdi
add    $0x1,%ecx
cmp    %rbp,%r15
jne    1295 <szl_parse_stmts+0x105>
jmp    12c0 <szl_parse_stmts+0x130>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%ecx
cmp    %rbp,%r15
jne    1295 <szl_parse_stmts+0x105>
jmp    12c0 <szl_parse_stmts+0x130>
nopw   0x0(%rax,%rax,1)
add    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %rbp,%r15
je     12c0 <szl_parse_stmts+0x130>
cmp    $0xa,%sil
jne    1230 <szl_parse_stmts+0xa0>
test   %edx,%edx
jne    1230 <szl_parse_stmts+0xa0>
test   %ecx,%ecx
jne    1230 <szl_parse_stmts+0xa0>
jmp    12d9 <szl_parse_stmts+0x149>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0xffffffff,%edx
cmp    %rbp,%r15
jne    1295 <szl_parse_stmts+0x105>
nopl   0x0(%rax,%rax,1)
test   %edx,%edx
jne    138b <szl_parse_stmts+0x1fb>
test   %ecx,%ecx
jne    139d <szl_parse_stmts+0x20d>
mov    %r15,%rbp
cmp    $0xa,%sil
jne    12df <szl_parse_stmts+0x14f>
movb   $0x0,0x0(%r13,%rbp,1)
lea    0x1(%rbp),%rcx
mov    %rcx,0x20(%rsp)
lea    -0x1(%rax),%r12
add    0x18(%rsp),%ebp
sub    %eax,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%r12),%edi
add    $0x1,%r12
call   1090 <szl_isspace@plt>
add    $0xffffffff,%ebp
test   %rax,%rax
jne    1300 <szl_parse_stmts+0x170>
mov    (%r12),%al
test   %al,%al
je     1210 <szl_parse_stmts+0x80>
cmp    $0x23,%al
je     1210 <szl_parse_stmts+0x80>
mov    (%rsp),%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1080 <szl_new_str@plt>
test   %rax,%rax
je     13b9 <szl_parse_stmts+0x229>
mov    %rax,%rbp
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    %rax,%rdx
call   10a0 <szl_list_append@plt>
mov    %rbp,%rdi
test   %eax,%eax
je     13b4 <szl_parse_stmts+0x224>
call   10b0 <szl_unref@plt>
jmp    1210 <szl_parse_stmts+0x80>
xor    %ebp,%ebp
jmp    1379 <szl_parse_stmts+0x1e9>
mov    0x8(%rsp),%rbp
jmp    1371 <szl_parse_stmts+0x1e1>
mov    %rax,%rbp
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbp,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%rdx
mov    (%rsp),%rdi
lea    0xcf1(%rip),%rsi
jmp    13ad <szl_parse_stmts+0x21d>
lea    0xcfb(%rip),%rsi
mov    0x10(%rsp),%rdx
mov    (%rsp),%rdi
call   1070 <szl_set_last_fmt@plt>
jmp    13b9 <szl_parse_stmts+0x229>
call   1040 <szl_free@plt>
mov    0x8(%rsp),%rdi
call   1040 <szl_free@plt>
xor    %ebp,%ebp
jmp    1371 <szl_parse_stmts+0x1e1>

LLVM IR (-O0):
%struct.szl_obj = type { i32 }
%struct.szl_interp = type { i32 }
@.str = [19 x i8] c"unbalanced {}: %s\0A\00"
@.str.1 = [19 x i8] c"unbalanced []: %s\0A\00"
define %struct.szl_obj* @szl_parse_stmts(%struct.szl_interp* %0, i8* %1, i64 %2) {
%4 = alloca %struct.szl_obj*
%5 = alloca %struct.szl_interp*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca %struct.szl_obj*
%9 = alloca %struct.szl_obj*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
store %struct.szl_interp* %0, %struct.szl_interp** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i8* null, i8** %12
store i8* null, i8** %13
store i64 0, i64* %14
store i32 0, i32* %15
store i32 0, i32* %16
%17 = load i8*, i8** %6
%18 = load i64, i64* %7
%19 = call i8* @strndup(i8* %17, i64 %18)
store i8* %19, i8** %10
%20 = load i8*, i8** %10
%21 = icmp ne i8* %20, null
br i1 %21, label %23, label %22
22: ; preds = %3
store %struct.szl_obj* null, %struct.szl_obj** %4
br label %203
23: ; preds = %3
%24 = load %struct.szl_interp*, %struct.szl_interp** %5
%25 = call %struct.szl_obj* @szl_new_list(%struct.szl_interp* %24, i32* null, i32 0)
store %struct.szl_obj* %25, %struct.szl_obj** %8
%26 = load %struct.szl_obj*, %struct.szl_obj** %8
%27 = icmp ne %struct.szl_obj* %26, null
br i1 %27, label %32, label %28
28: ; preds = %23
%29 = load i8*, i8** %10
%30 = call i32 @free(i8* %29)
%31 = load %struct.szl_obj*, %struct.szl_obj** %8
store %struct.szl_obj* %31, %struct.szl_obj** %4
br label %203
32: ; preds = %23
%33 = load i8*, i8** %10
store i8* %33, i8** %11
br label %34
34: ; preds = %195, %121, %32
%35 = load i64, i64* %14
%36 = load i64, i64* %7
%37 = icmp ult i64 %35, %36
br i1 %37, label %38, label %199
38: ; preds = %34
%39 = load i8*, i8** %10
%40 = load i64, i64* %14
%41 = getelementptr inbounds i8, i8* %39, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 123
br i1 %44, label %45, label %48
45: ; preds = %38
%46 = load i32, i32* %15
%47 = add nsw i32 %46, 1
store i32 %47, i32* %15
br label %81
48: ; preds = %38
%49 = load i8*, i8** %10
%50 = load i64, i64* %14
%51 = getelementptr inbounds i8, i8* %49, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 125
br i1 %54, label %55, label %58
55: ; preds = %48
%56 = load i32, i32* %15
%57 = add nsw i32 %56, -1
store i32 %57, i32* %15
br label %80
58: ; preds = %48
%59 = load i8*, i8** %10
%60 = load i64, i64* %14
%61 = getelementptr inbounds i8, i8* %59, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 91
br i1 %64, label %65, label %68
65: ; preds = %58
%66 = load i32, i32* %16
%67 = add nsw i32 %66, 1
store i32 %67, i32* %16
br label %79
68: ; preds = %58
%69 = load i8*, i8** %10
%70 = load i64, i64* %14
%71 = getelementptr inbounds i8, i8* %69, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 93
br i1 %74, label %75, label %78
75: ; preds = %68
%76 = load i32, i32* %16
%77 = add nsw i32 %76, -1
store i32 %77, i32* %16
br label %78
78: ; preds = %75, %68
br label %79
79: ; preds = %78, %65
br label %80
80: ; preds = %79, %55
br label %81
81: ; preds = %80, %45
%82 = load i64, i64* %14
%83 = load i64, i64* %7
%84 = sub i64 %83, 1
%85 = icmp eq i64 %82, %84
br i1 %85, label %86, label %108
86: ; preds = %81
%87 = load i32, i32* %15
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %86
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %13
br label %95
90: ; preds = %86
%91 = load i32, i32* %16
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %90
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8** %13
br label %94
94: ; preds = %93, %90
br label %95
95: ; preds = %94, %89
%96 = load i8*, i8** %13
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %107
98: ; preds = %95
%99 = load %struct.szl_interp*, %struct.szl_interp** %5
%100 = load i8*, i8** %13
%101 = load i8*, i8** %6
%102 = call i32 @szl_set_last_fmt(%struct.szl_interp* %99, i8* %100, i8* %101)
%103 = load %struct.szl_obj*, %struct.szl_obj** %8
%104 = call i32 @szl_free(%struct.szl_obj* %103)
%105 = load i8*, i8** %10
%106 = call i32 @free(i8* %105)
store %struct.szl_obj* null, %struct.szl_obj** %4
br label %203
107: ; preds = %95
br label %125
108: ; preds = %81
%109 = load i8*, i8** %10
%110 = load i64, i64* %14
%111 = getelementptr inbounds i8, i8* %109, i64 %110
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp ne i32 %113, 10
br i1 %114, label %121, label %115
115: ; preds = %108
%116 = load i32, i32* %15
%117 = icmp ne i32 %116, 0
br i1 %117, label %121, label %118
118: ; preds = %115
%119 = load i32, i32* %16
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %124
121: ; preds = %118, %115, %108
%122 = load i64, i64* %14
%123 = add i64 %122, 1
store i64 %123, i64* %14
br label %34
124: ; preds = %118
br label %125
125: ; preds = %124, %107
%126 = load i8*, i8** %10
%127 = load i64, i64* %14
%128 = getelementptr inbounds i8, i8* %126, i64 %127
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp eq i32 %130, 10
br i1 %131, label %132, label %136
132: ; preds = %125
%133 = load i8*, i8** %10
%134 = load i64, i64* %14
%135 = getelementptr inbounds i8, i8* %133, i64 %134
store i8 0, i8* %135
br label %136
136: ; preds = %132, %125
%137 = load i8*, i8** %10
%138 = load i64, i64* %14
%139 = add i64 %138, 1
%140 = getelementptr inbounds i8, i8* %137, i64 %139
store i8* %140, i8** %12
br label %141
141: ; preds = %147, %136
%142 = load i8*, i8** %11
%143 = load i8, i8* %142
%144 = call i64 @szl_isspace(i8 signext %143)
%145 = icmp ne i64 %144, 0
br i1 %145, label %146, label %150
146: ; preds = %141
br label %147
147: ; preds = %146
%148 = load i8*, i8** %11
%149 = getelementptr inbounds i8, i8* %148, i32 1
store i8* %149, i8** %11
br label %141
150: ; preds = %141
%151 = load i8*, i8** %11
%152 = getelementptr inbounds i8, i8* %151, i64 0
%153 = load i8, i8* %152
%154 = sext i8 %153 to i32
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %195
156: ; preds = %150
%157 = load i8*, i8** %11
%158 = getelementptr inbounds i8, i8* %157, i64 0
%159 = load i8, i8* %158
%160 = sext i8 %159 to i32
%161 = icmp ne i32 %160, 35
br i1 %161, label %162, label %195
162: ; preds = %156
%163 = load %struct.szl_interp*, %struct.szl_interp** %5
%164 = load i8*, i8** %11
%165 = load i8*, i8** %12
%166 = load i8*, i8** %11
%167 = ptrtoint i8* %165 to i64
%168 = ptrtoint i8* %166 to i64
%169 = sub i64 %167, %168
%170 = trunc i64 %169 to i32
%171 = call %struct.szl_obj* @szl_new_str(%struct.szl_interp* %163, i8* %164, i32 %170)
store %struct.szl_obj* %171, %struct.szl_obj** %9
%172 = load %struct.szl_obj*, %struct.szl_obj** %9
%173 = icmp ne %struct.szl_obj* %172, null
br i1 %173, label %179, label %174
174: ; preds = %162
%175 = load %struct.szl_obj*, %struct.szl_obj** %8
%176 = call i32 @szl_free(%struct.szl_obj* %175)
%177 = load i8*, i8** %10
%178 = call i32 @free(i8* %177)
store %struct.szl_obj* null, %struct.szl_obj** %4
br label %203
179: ; preds = %162
%180 = load %struct.szl_interp*, %struct.szl_interp** %5
%181 = load %struct.szl_obj*, %struct.szl_obj** %8
%182 = load %struct.szl_obj*, %struct.szl_obj** %9
%183 = call i32 @szl_list_append(%struct.szl_interp* %180, %struct.szl_obj* %181, %struct.szl_obj* %182)
%184 = icmp ne i32 %183, 0
br i1 %184, label %192, label %185
185: ; preds = %179
%186 = load %struct.szl_obj*, %struct.szl_obj** %9
%187 = call i32 @szl_free(%struct.szl_obj* %186)
%188 = load %struct.szl_obj*, %struct.szl_obj** %8
%189 = call i32 @szl_free(%struct.szl_obj* %188)
%190 = load i8*, i8** %10
%191 = call i32 @free(i8* %190)
store %struct.szl_obj* null, %struct.szl_obj** %4
br label %203
192: ; preds = %179
%193 = load %struct.szl_obj*, %struct.szl_obj** %9
%194 = call i32 @szl_unref(%struct.szl_obj* %193)
br label %195
195: ; preds = %192, %156, %150
%196 = load i8*, i8** %12
store i8* %196, i8** %11
%197 = load i64, i64* %14
%198 = add i64 %197, 1
store i64 %198, i64* %14
br label %34
199: ; preds = %34
%200 = load i8*, i8** %10
%201 = call i32 @free(i8* %200)
%202 = load %struct.szl_obj*, %struct.szl_obj** %8
store %struct.szl_obj* %202, %struct.szl_obj** %4
br label %203
203: ; preds = %199, %185, %174, %98, %28, %22
%204 = load %struct.szl_obj*, %struct.szl_obj** %4
ret %struct.szl_obj* %204
}

LLVM IR (-O2):
%struct.szl_obj = type { i32 }
%struct.szl_interp = type { i32 }
@.str = [19 x i8] c"unbalanced {}: %s\0A\00"
@.str.1 = [19 x i8] c"unbalanced []: %s\0A\00"
define %struct.szl_obj* @szl_parse_stmts(%struct.szl_interp* %0, i8* %1, i64 %2) {
%4 = tail call i8* @strndup(i8* %1, i64 %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %88, label %6
6: ; preds = %3
%7 = tail call %struct.szl_obj* @szl_new_list(%struct.szl_interp* %0, i32* null, i32 0)
%8 = icmp eq %struct.szl_obj* %7, null
br i1 %8, label %85, label %9
9: ; preds = %6
%10 = icmp eq i64 %2, 0
br i1 %10, label %85, label %11
11: ; preds = %9
%12 = add i64 %2, -1
br label %80
13: ; preds = %80, %44
%14 = phi i32 [ 0, %80 ], [ %29, %44 ]
%15 = phi i32 [ 0, %80 ], [ %28, %44 ]
%16 = phi i64 [ %81, %80 ], [ %45, %44 ]
%17 = getelementptr inbounds i8, i8* %4, i64 %16
%18 = load i8, i8* %17
switch i8 %18, label %27 [
i8 123, label %19
i8 125, label %21
i8 91, label %23
i8 93, label %25
]
19: ; preds = %13
%20 = add nsw i32 %15, 1
br label %27
21: ; preds = %13
%22 = add nsw i32 %15, -1
br label %27
23: ; preds = %13
%24 = add nsw i32 %14, 1
br label %27
25: ; preds = %13
%26 = add nsw i32 %14, -1
br label %27
27: ; preds = %13, %21, %25, %23, %19
%28 = phi i32 [ %20, %19 ], [ %22, %21 ], [ %15, %23 ], [ %15, %25 ], [ %15, %13 ]
%29 = phi i32 [ %14, %19 ], [ %14, %21 ], [ %24, %23 ], [ %26, %25 ], [ %14, %13 ]
%30 = icmp eq i64 %16, %12
br i1 %30, label %31, label %38
31: ; preds = %27
%32 = icmp eq i32 %28, 0
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = icmp eq i32 %29, 0
br i1 %34, label %47, label %35
35: ; preds = %31, %33
%36 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %33 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %31 ]
%37 = tail call i32 @szl_set_last_fmt(%struct.szl_interp* %0, i8* %36, i8* %1)
br label %83
38: ; preds = %27
%39 = icmp ne i8 %18, 10
%40 = icmp ne i32 %28, 0
%41 = select i1 %39, i1 true, i1 %40
%42 = icmp ne i32 %29, 0
%43 = select i1 %41, i1 true, i1 %42
br i1 %43, label %44, label %49
44: ; preds = %38
%45 = add nuw i64 %16, 1
%46 = icmp ult i64 %45, %2
br i1 %46, label %13, label %85
47: ; preds = %33
%48 = icmp eq i8 %18, 10
br i1 %48, label %49, label %52
49: ; preds = %38, %47
%50 = phi i64 [ %12, %47 ], [ %16, %38 ]
%51 = getelementptr inbounds i8, i8* %4, i64 %50
store i8 0, i8* %51
br label %52
52: ; preds = %49, %47
%53 = phi i64 [ %50, %49 ], [ %12, %47 ]
%54 = add nuw i64 %53, 1
br label %55
55: ; preds = %55, %52
%56 = phi i8* [ %82, %52 ], [ %60, %55 ]
%57 = load i8, i8* %56
%58 = tail call i64 @szl_isspace(i8 signext %57)
%59 = icmp eq i64 %58, 0
%60 = getelementptr inbounds i8, i8* %56, i64 1
br i1 %59, label %61, label %55
61: ; preds = %55
%62 = getelementptr inbounds i8, i8* %4, i64 %54
%63 = load i8, i8* %56
switch i8 %63, label %64 [
i8 0, label %78
i8 35, label %78
]
64: ; preds = %61
%65 = ptrtoint i8* %62 to i64
%66 = ptrtoint i8* %56 to i64
%67 = sub i64 %65, %66
%68 = trunc i64 %67 to i32
%69 = tail call %struct.szl_obj* @szl_new_str(%struct.szl_interp* %0, i8* %56, i32 %68)
%70 = icmp eq %struct.szl_obj* %69, null
br i1 %70, label %83, label %71
71: ; preds = %64
%72 = tail call i32 @szl_list_append(%struct.szl_interp* %0, %struct.szl_obj* %7, %struct.szl_obj* %69)
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = tail call i32 @szl_free(%struct.szl_obj* %69)
br label %83
76: ; preds = %71
%77 = tail call i32 @szl_unref(%struct.szl_obj* %69)
br label %78
78: ; preds = %61, %61, %76
%79 = icmp ult i64 %54, %2
br i1 %79, label %80, label %85
80: ; preds = %11, %78
%81 = phi i64 [ 0, %11 ], [ %54, %78 ]
%82 = phi i8* [ %4, %11 ], [ %62, %78 ]
br label %13
83: ; preds = %64, %74, %35
%84 = tail call i32 @szl_free(%struct.szl_obj* %7)
br label %85
85: ; preds = %78, %44, %83, %9, %6
%86 = phi %struct.szl_obj* [ null, %6 ], [ %7, %9 ], [ null, %83 ], [ %7, %44 ], [ %7, %78 ]
%87 = tail call i32 @free(i8* %4)
br label %88
88: ; preds = %85, %3
%89 = phi %struct.szl_obj* [ null, %3 ], [ %86, %85 ]
ret %struct.szl_obj* %89
}