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

/* Variables and functions */
scalar_t__ block_quote_line(struct cymkd_parser *);
int /*<<< orphan*/ consume(struct cymkd_parser *);
int /*<<< orphan*/ match(struct cymkd_parser *, char);
int next(struct cymkd_parser *);
int /*<<< orphan*/ parser_emit_char(struct cymkd_parser *, char);
int /*<<< orphan*/ parser_emit_string(struct cymkd_parser *, char *);
bool block_quote(struct cymkd_parser *parser) {
  if (next(parser) == '>') {
    parser_emit_string(parser, "<blockquote>");
    while (block_quote_line(parser)) {
      if (next(parser) == -1) {
        parser_emit_string(parser, "</blockquote>");
        return true;
      }
      if (!match(parser, '\n')) {
        return false;
      }
      if (next(parser) == '\n' || next(parser) == -1) {
        consume(parser);
        parser_emit_string(parser, "</blockquote>");
        return true;
      }
      parser_emit_char(parser, ' ');
    }
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<block_quote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <next@plt>
cmp    $0x3e,%eax
jne    125a <block_quote+0xfa>
mov    -0x10(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1050 <parser_emit_string@plt>
mov    -0x10(%rbp),%rdi
call   1070 <block_quote_line@plt>
cmp    $0x0,%rax
je     124e <block_quote+0xee>
mov    -0x10(%rbp),%rdi
call   1030 <next@plt>
cmp    $0xffffffff,%eax
jne    11cf <block_quote+0x6f>
mov    -0x10(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1050 <parser_emit_string@plt>
movl   $0x1,-0x4(%rbp)
jmp    1261 <block_quote+0x101>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1060 <match@plt>
cmp    $0x0,%eax
jne    11f2 <block_quote+0x92>
movl   $0x0,-0x4(%rbp)
jmp    1261 <block_quote+0x101>
mov    -0x10(%rbp),%rdi
call   1030 <next@plt>
cmp    $0xa,%eax
je     1216 <block_quote+0xb6>
mov    -0x10(%rbp),%rdi
call   1030 <next@plt>
cmp    $0xffffffff,%eax
jne    123b <block_quote+0xdb>
mov    -0x10(%rbp),%rdi
call   1040 <consume@plt>
mov    -0x10(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1050 <parser_emit_string@plt>
movl   $0x1,-0x4(%rbp)
jmp    1261 <block_quote+0x101>
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1080 <parser_emit_char@plt>
jmp    118e <block_quote+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1261 <block_quote+0x101>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_quote>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <next@plt>
cmp    $0x3e,%eax
jne    11e5 <block_quote+0x85>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1050 <parser_emit_string@plt>
mov    %rbx,%rdi
call   1070 <block_quote_line@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1200 <block_quote+0xa0>
mov    %rbx,%rdi
call   1030 <next@plt>
cmp    $0xffffffff,%eax
je     11f1 <block_quote+0x91>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <match@plt>
test   %eax,%eax
je     11e5 <block_quote+0x85>
mov    %rbx,%rdi
call   1030 <next@plt>
cmp    $0xa,%eax
je     11e9 <block_quote+0x89>
mov    %rbx,%rdi
call   1030 <next@plt>
cmp    $0xffffffff,%eax
je     11e9 <block_quote+0x89>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1080 <parser_emit_char@plt>
mov    %rbx,%rdi
call   1070 <block_quote_line@plt>
test   %rax,%rax
jne    1191 <block_quote+0x31>
jmp    1200 <block_quote+0xa0>
xor    %ebp,%ebp
jmp    1200 <block_quote+0xa0>
mov    %rbx,%rdi
call   1040 <consume@plt>
lea    0xe15(%rip),%rsi
mov    %rbx,%rdi
call   1050 <parser_emit_string@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.cymkd_parser = type { i32 }
@.str = [13 x i8] c"<blockquote>\00"
@.str.1 = [14 x i8] c"</blockquote>\00"
define i32 @block_quote(%struct.cymkd_parser* %0) {
%2 = alloca i32
%3 = alloca %struct.cymkd_parser*
store %struct.cymkd_parser* %0, %struct.cymkd_parser** %3
%4 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%5 = call i32 @next(%struct.cymkd_parser* %4)
%6 = icmp eq i32 %5, 62
br i1 %6, label %7, label %43
7: ; preds = %1
%8 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%9 = call i32 @parser_emit_string(%struct.cymkd_parser* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %39, %7
%11 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%12 = call i64 @block_quote_line(%struct.cymkd_parser* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %42
14: ; preds = %10
%15 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%16 = call i32 @next(%struct.cymkd_parser* %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%20 = call i32 @parser_emit_string(%struct.cymkd_parser* %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %44
21: ; preds = %14
%22 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%23 = call i32 @match(%struct.cymkd_parser* %22, i8 signext 10)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
store i32 0, i32* %2
br label %44
26: ; preds = %21
%27 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%28 = call i32 @next(%struct.cymkd_parser* %27)
%29 = icmp eq i32 %28, 10
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%32 = call i32 @next(%struct.cymkd_parser* %31)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %39
34: ; preds = %30, %26
%35 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%36 = call i32 @consume(%struct.cymkd_parser* %35)
%37 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%38 = call i32 @parser_emit_string(%struct.cymkd_parser* %37, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %44
39: ; preds = %30
%40 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%41 = call i32 @parser_emit_char(%struct.cymkd_parser* %40, i8 signext 32)
br label %10
42: ; preds = %10
store i32 1, i32* %2
br label %44
43: ; preds = %1
store i32 0, i32* %2
br label %44
44: ; preds = %43, %42, %34, %25, %18
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
%struct.cymkd_parser = type { i32 }
@.str = [13 x i8] c"<blockquote>\00"
@.str.1 = [14 x i8] c"</blockquote>\00"
define i32 @block_quote(%struct.cymkd_parser* %0) {
%2 = tail call i32 @next(%struct.cymkd_parser* %0)
%3 = icmp eq i32 %2, 62
br i1 %3, label %4, label %28
4: ; preds = %1
%5 = tail call i32 @parser_emit_string(%struct.cymkd_parser* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = tail call i64 @block_quote_line(%struct.cymkd_parser* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %28, label %8
8: ; preds = %4, %22
%9 = tail call i32 @next(%struct.cymkd_parser* %0)
%10 = icmp eq i32 %9, -1
br i1 %10, label %26, label %11
11: ; preds = %8
%12 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 10)
%13 = icmp eq i32 %12, 0
br i1 %13, label %28, label %14
14: ; preds = %11
%15 = tail call i32 @next(%struct.cymkd_parser* %0)
%16 = icmp eq i32 %15, 10
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = tail call i32 @next(%struct.cymkd_parser* %0)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17, %14
%21 = tail call i32 @consume(%struct.cymkd_parser* %0)
br label %26
22: ; preds = %17
%23 = tail call i32 @parser_emit_char(%struct.cymkd_parser* %0, i8 signext 32)
%24 = tail call i64 @block_quote_line(%struct.cymkd_parser* %0)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %8
26: ; preds = %8, %20
%27 = tail call i32 @parser_emit_string(%struct.cymkd_parser* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %11, %22, %26, %4, %1
%29 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 1, %26 ], [ 0, %11 ], [ 1, %22 ]
ret i32 %29
}