#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__ match(struct cymkd_parser *, char);
scalar_t__ next(struct cymkd_parser *);
scalar_t__ ordered_list_line(struct cymkd_parser *, char const *);
int /*<<< orphan*/ parser_emit_string(struct cymkd_parser *, char *);
bool ordered_list_internal(struct cymkd_parser *parser,
                           const char *curr_indent) {
  parser_emit_string(parser, "<ol>");
  while (ordered_list_line(parser, curr_indent)) {
    while (match(parser, '\n') && ordered_list_line(parser, curr_indent) &&
           next(parser) >= 0) {
      ;
    }
  }
  parser_emit_string(parser, "</ol>");
  return true;
}


x86 assembly (clang, -O0):
<ordered_list_internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1050 <parser_emit_string@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ordered_list_line@plt>
cmp    $0x0,%rax
je     11e8 <ordered_list_internal+0xa8>
jmp    117c <ordered_list_internal+0x3c>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1060 <match@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     11ce <ordered_list_internal+0x8e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ordered_list_line@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     11ce <ordered_list_internal+0x8e>
mov    -0x8(%rbp),%rdi
call   1040 <next@plt>
cmp    $0x0,%rax
setge  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11de <ordered_list_internal+0x9e>
jmp    11e3 <ordered_list_internal+0xa3>
jmp    117c <ordered_list_internal+0x3c>
jmp    1160 <ordered_list_internal+0x20>
mov    -0x8(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1050 <parser_emit_string@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ordered_list_internal>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeaf(%rip),%rsi
call   1050 <parser_emit_string@plt>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ordered_list_line@plt>
test   %rax,%rax
je     11a1 <ordered_list_internal+0x61>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <match@plt>
test   %rax,%rax
je     1160 <ordered_list_internal+0x20>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ordered_list_line@plt>
test   %rax,%rax
je     1160 <ordered_list_internal+0x20>
mov    %rbx,%rdi
call   1040 <next@plt>
test   %rax,%rax
jns    1170 <ordered_list_internal+0x30>
jmp    1160 <ordered_list_internal+0x20>
lea    0xe5d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <parser_emit_string@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.cymkd_parser = type { i32 }
@.str = [5 x i8] c"<ol>\00"
@.str.1 = [6 x i8] c"</ol>\00"
define i32 @ordered_list_internal(%struct.cymkd_parser* %0, i8* %1) {
%3 = alloca %struct.cymkd_parser*
%4 = alloca i8*
store %struct.cymkd_parser* %0, %struct.cymkd_parser** %3
store i8* %1, i8** %4
%5 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%6 = call i32 @parser_emit_string(%struct.cymkd_parser* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %29, %2
%8 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%9 = load i8*, i8** %4
%10 = call i64 @ordered_list_line(%struct.cymkd_parser* %8, i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %30
12: ; preds = %7
br label %13
13: ; preds = %28, %12
%14 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%15 = call i64 @match(%struct.cymkd_parser* %14, i8 signext 10)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%19 = load i8*, i8** %4
%20 = call i64 @ordered_list_line(%struct.cymkd_parser* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %17
%23 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%24 = call i64 @next(%struct.cymkd_parser* %23)
%25 = icmp sge i64 %24, 0
br label %26
26: ; preds = %22, %17, %13
%27 = phi i1 [ false, %17 ], [ false, %13 ], [ %25, %22 ]
br i1 %27, label %28, label %29
28: ; preds = %26
br label %13
29: ; preds = %26
br label %7
30: ; preds = %7
%31 = load %struct.cymkd_parser*, %struct.cymkd_parser** %3
%32 = call i32 @parser_emit_string(%struct.cymkd_parser* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
%struct.cymkd_parser = type { i32 }
@.str = [5 x i8] c"<ol>\00"
@.str.1 = [6 x i8] c"</ol>\00"
define i32 @ordered_list_internal(%struct.cymkd_parser* %0, i8* %1) {
%3 = tail call i32 @parser_emit_string(%struct.cymkd_parser* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = tail call i64 @ordered_list_line(%struct.cymkd_parser* %0, i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %2, %15
%7 = tail call i64 @match(%struct.cymkd_parser* %0, i8 signext 10)
%8 = icmp eq i64 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i64 @ordered_list_line(%struct.cymkd_parser* %0, i8* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = tail call i64 @next(%struct.cymkd_parser* %0)
%14 = icmp sgt i64 %13, -1
br i1 %14, label %15, label %16
15: ; preds = %12, %16
br label %6
16: ; preds = %6, %9, %12
%17 = tail call i64 @ordered_list_line(%struct.cymkd_parser* %0, i8* %1)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %15
19: ; preds = %16, %2
%20 = tail call i32 @parser_emit_string(%struct.cymkd_parser* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}