#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__ code_line(struct cymkd_parser *);
int /*<<< orphan*/ consume(struct cymkd_parser *);
int /*<<< orphan*/ match(struct cymkd_parser *, char);
char next(struct cymkd_parser *);
int /*<<< orphan*/ parser_emit_char(struct cymkd_parser *, char);
int /*<<< orphan*/ parser_emit_string(struct cymkd_parser *, char *);
bool code_block(struct cymkd_parser *parser) {
  int i;
  for (i = 0; i < 3; i++) {
    if (!match(parser, '`')) {
      return false;
    }
  }
  while (next(parser) != '\n') {
    consume(parser);
  }
  if (!match(parser, '\n')) {
    return false;
  }
  parser_emit_string(parser, "<pre><code>");
  while (code_line(parser)) {
    if (!match(parser, '\n')) {
      return false;
    }
    parser_emit_char(parser, '\n');
    if (next(parser) == '`') {
      bool done = true;
      for (i = 0; i < 3; i++) {
        if (!match(parser, '`')) {
          done = false;
          break;
        }
      }
      if (!match(parser, '\n')) {
        return false;
      }
      if (done) {
        break;
      }
    }
  }
  parser_emit_string(parser, "</code></pre>");
  return true;
}


x86 assembly (clang, -O0):
<code_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11b3 <code_block+0x53>
mov    -0x10(%rbp),%rdi
mov    $0x60,%esi
call   1070 <match@plt>
cmp    $0x0,%eax
jne    11a0 <code_block+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1308 <code_block+0x1a8>
jmp    11a5 <code_block+0x45>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1173 <code_block+0x13>
jmp    11b8 <code_block+0x58>
mov    -0x10(%rbp),%rdi
call   1040 <next@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11db <code_block+0x7b>
mov    -0x10(%rbp),%rdi
call   1050 <consume@plt>
jmp    11b8 <code_block+0x58>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1070 <match@plt>
cmp    $0x0,%eax
jne    11fe <code_block+0x9e>
movl   $0x0,-0x4(%rbp)
jmp    1308 <code_block+0x1a8>
mov    -0x10(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   1060 <parser_emit_string@plt>
mov    -0x10(%rbp),%rdi
call   1030 <code_line@plt>
cmp    $0x0,%rax
je     12f1 <code_block+0x191>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1070 <match@plt>
cmp    $0x0,%eax
jne    1244 <code_block+0xe4>
movl   $0x0,-0x4(%rbp)
jmp    1308 <code_block+0x1a8>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1080 <parser_emit_char@plt>
mov    -0x10(%rbp),%rdi
call   1040 <next@plt>
movsbl %al,%eax
cmp    $0x60,%eax
jne    12ec <code_block+0x18c>
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    12b5 <code_block+0x155>
mov    -0x10(%rbp),%rdi
mov    $0x60,%esi
call   1070 <match@plt>
cmp    $0x0,%eax
jne    12a2 <code_block+0x142>
movl   $0x0,-0x18(%rbp)
jmp    12b5 <code_block+0x155>
jmp    12a7 <code_block+0x147>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1275 <code_block+0x115>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1070 <match@plt>
cmp    $0x0,%eax
jne    12d8 <code_block+0x178>
movl   $0x0,-0x4(%rbp)
jmp    1308 <code_block+0x1a8>
cmpl   $0x0,-0x18(%rbp)
je     12e7 <code_block+0x187>
jmp    12f1 <code_block+0x191>
jmp    12ec <code_block+0x18c>
jmp    120e <code_block+0xae>
mov    -0x10(%rbp),%rdi
lea    0xd10(%rip),%rsi
call   1060 <parser_emit_string@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code_block>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x60,%esi
call   1070 <match@plt>
test   %eax,%eax
je     12b3 <code_block+0x153>
mov    %rbx,%rdi
mov    $0x60,%esi
call   1070 <match@plt>
test   %eax,%eax
je     12b3 <code_block+0x153>
mov    %rbx,%rdi
mov    $0x60,%esi
call   1070 <match@plt>
test   %eax,%eax
je     12b3 <code_block+0x153>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <next@plt>
mov    %rbx,%rdi
cmp    $0xa,%al
je     11c6 <code_block+0x66>
call   1050 <consume@plt>
jmp    11b0 <code_block+0x50>
mov    $0xa,%esi
call   1070 <match@plt>
test   %eax,%eax
je     12b3 <code_block+0x153>
lea    0xe21(%rip),%rsi
mov    %rbx,%rdi
call   1060 <parser_emit_string@plt>
mov    %rbx,%rdi
call   1030 <code_line@plt>
test   %rax,%rax
je     12c9 <code_block+0x169>
mov    $0x1,%r14d
xor    %r15d,%r15d
jmp    123c <code_block+0xdc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <match@plt>
test   %eax,%eax
cmove  %r14d,%ebp
test   %ebp,%ebp
jne    12c4 <code_block+0x164>
mov    %rbx,%rdi
call   1030 <code_line@plt>
test   %rax,%rax
je     12c9 <code_block+0x169>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <match@plt>
test   %eax,%eax
je     12b3 <code_block+0x153>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <parser_emit_char@plt>
mov    %rbx,%rdi
call   1040 <next@plt>
cmp    $0x60,%al
jne    122b <code_block+0xcb>
mov    %rbx,%rdi
mov    $0x60,%esi
call   1070 <match@plt>
mov    $0x0,%ebp
test   %eax,%eax
je     1210 <code_block+0xb0>
mov    %rbx,%rdi
mov    $0x60,%esi
call   1070 <match@plt>
mov    $0x0,%ebp
test   %eax,%eax
je     1210 <code_block+0xb0>
mov    %rbx,%rdi
mov    $0x60,%esi
call   1070 <match@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
shl    $0x3,%ebp
jmp    1210 <code_block+0xb0>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x8,%ebp
jne    12b6 <code_block+0x156>
lea    0xd3c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <parser_emit_string@plt>
mov    $0x1,%r15d
jmp    12b6 <code_block+0x156>

LLVM IR (-O0):
%struct.cymkd_parser = type { i32 }
@.str = [12 x i8] c"<pre><code>\00"
@.str.1 = [14 x i8] c"</code></pre>\00"
define i32 @code_block(%struct.cymkd_parser* %0) {
%2 = alloca i32
%3 = alloca %struct.cymkd_parser*
%4 = alloca i32
%5 = alloca i32
store %struct.cymkd_parser* %0, %struct.cymkd_parser** %3
store i32 0, i32* %4
br label %6
6: ; preds = %15, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%11 = call i32 @match(%struct.cymkd_parser* %10, i8 signext 96)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
store i32 0, i32* %2
br label %78
14: ; preds = %9
br label %15
15: ; preds = %14
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %6
18: ; preds = %6
br label %19
19: ; preds = %24, %18
%20 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%21 = call signext i8 @next(%struct.cymkd_parser* %20)
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 10
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%26 = call i32 @consume(%struct.cymkd_parser* %25)
br label %19
27: ; preds = %19
%28 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%29 = call i32 @match(%struct.cymkd_parser* %28, i8 signext 10)
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store i32 0, i32* %2
br label %78
32: ; preds = %27
%33 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%34 = call i32 @parser_emit_string(%struct.cymkd_parser* %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %35
35: ; preds = %74, %32
%36 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%37 = call i64 @code_line(%struct.cymkd_parser* %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %75
39: ; preds = %35
%40 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%41 = call i32 @match(%struct.cymkd_parser* %40, i8 signext 10)
%42 = icmp ne i32 %41, 0
br i1 %42, label %44, label %43
43: ; preds = %39
store i32 0, i32* %2
br label %78
44: ; preds = %39
%45 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%46 = call i32 @parser_emit_char(%struct.cymkd_parser* %45, i8 signext 10)
%47 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%48 = call signext i8 @next(%struct.cymkd_parser* %47)
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 96
br i1 %50, label %51, label %74
51: ; preds = %44
store i32 1, i32* %5
store i32 0, i32* %4
br label %52
52: ; preds = %61, %51
%53 = load i32, i32* %4
%54 = icmp slt i32 %53, 3
br i1 %54, label %55, label %64
55: ; preds = %52
%56 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%57 = call i32 @match(%struct.cymkd_parser* %56, i8 signext 96)
%58 = icmp ne i32 %57, 0
br i1 %58, label %60, label %59
59: ; preds = %55
store i32 0, i32* %5
br label %64
60: ; preds = %55
br label %61
61: ; preds = %60
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
store i32 %63, i32* %4
br label %52
64: ; preds = %59, %52
%65 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%66 = call i32 @match(%struct.cymkd_parser* %65, i8 signext 10)
%67 = icmp ne i32 %66, 0
br i1 %67, label %69, label %68
68: ; preds = %64
store i32 0, i32* %2
br label %78
69: ; preds = %64
%70 = load i32, i32* %5
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %69
br label %75
73: ; preds = %69
br label %74
74: ; preds = %73, %44
br label %35
75: ; preds = %72, %35
%76 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%77 = call i32 @parser_emit_string(%struct.cymkd_parser* %76, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %78
78: ; preds = %75, %68, %43, %31, %13
%79 = load i32, i32* %2
ret i32 %79
}

LLVM IR (-O2):
%struct.cymkd_parser = type { i32 }
@.str = [12 x i8] c"<pre><code>\00"
@.str.1 = [14 x i8] c"</code></pre>\00"
define i32 @code_block(%struct.cymkd_parser* %0) {
%2 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 96)
%3 = icmp eq i32 %2, 0
br i1 %3, label %51, label %4
4: ; preds = %1
%5 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 96)
%6 = icmp eq i32 %5, 0
br i1 %6, label %51, label %7
7: ; preds = %4
%8 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 96)
%9 = icmp eq i32 %8, 0
br i1 %9, label %51, label %10
10: ; preds = %7
%11 = tail call signext i8 @next(%struct.cymkd_parser* %0)
%12 = icmp eq i8 %11, 10
br i1 %12, label %17, label %13
13: ; preds = %10, %13
%14 = tail call i32 @consume(%struct.cymkd_parser* %0)
%15 = tail call signext i8 @next(%struct.cymkd_parser* %0)
%16 = icmp eq i8 %15, 10
br i1 %16, label %17, label %13
17: ; preds = %13, %10
%18 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 10)
%19 = icmp eq i32 %18, 0
br i1 %19, label %51, label %20
20: ; preds = %17
%21 = tail call i32 @parser_emit_string(%struct.cymkd_parser* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%22 = tail call i64 @code_line(%struct.cymkd_parser* %0)
%23 = icmp eq i64 %22, 0
br i1 %23, label %49, label %24
24: ; preds = %20, %46
%25 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 10)
%26 = icmp eq i32 %25, 0
br i1 %26, label %51, label %27
27: ; preds = %24
%28 = tail call i32 @parser_emit_char(%struct.cymkd_parser* %0, i8 signext 10)
%29 = tail call signext i8 @next(%struct.cymkd_parser* %0)
%30 = icmp eq i8 %29, 96
br i1 %30, label %31, label %46
31: ; preds = %27
%32 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 96)
%33 = icmp eq i32 %32, 0
br i1 %33, label %41, label %34
34: ; preds = %31
%35 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 96)
%36 = icmp eq i32 %35, 0
br i1 %36, label %41, label %37
37: ; preds = %34
%38 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 96)
%39 = icmp eq i32 %38, 0
%40 = select i1 %39, i32 0, i32 8
br label %41
41: ; preds = %37, %34, %31
%42 = phi i32 [ 0, %31 ], [ 0, %34 ], [ %40, %37 ]
%43 = tail call i32 @match(%struct.cymkd_parser* %0, i8 signext 10)
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, i32 1, i32 %42
switch i32 %45, label %51 [
i32 0, label %46
i32 8, label %49
]
46: ; preds = %41, %27
%47 = tail call i64 @code_line(%struct.cymkd_parser* %0)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %24
49: ; preds = %46, %41, %20
%50 = 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 %51
51: ; preds = %24, %41, %1, %4, %7, %17, %49
%52 = phi i32 [ 1, %49 ], [ 0, %17 ], [ 0, %7 ], [ 0, %4 ], [ 0, %1 ], [ 0, %41 ], [ 0, %24 ]
ret i32 %52
}