#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 */
int /*<<< orphan*/ consume(struct cymkd_parser *);
int next(struct cymkd_parser *);
int /*<<< orphan*/ parser_emit_char(struct cymkd_parser *, int);
int /*<<< orphan*/ parser_emit_string(struct cymkd_parser *, char *);
bool code_line(struct cymkd_parser *parser) {
  int ch;
  while ((ch = next(parser)) != '\n') {
    if (ch == '<') {
      parser_emit_string(parser, "&lt;");
    } else if (ch == '>') {
      parser_emit_string(parser, "&gt;");
    } else {
      parser_emit_char(parser, ch);
    }
    consume(parser);
  }
  return true;
}


x86 assembly (clang, -O0):
<code_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <next@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xa,%eax
je     11be <code_line+0x7e>
cmpl   $0x3c,-0xc(%rbp)
jne    1180 <code_line+0x40>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1050 <parser_emit_string@plt>
jmp    11b0 <code_line+0x70>
cmpl   $0x3e,-0xc(%rbp)
jne    119f <code_line+0x5f>
mov    -0x8(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1050 <parser_emit_string@plt>
jmp    11ab <code_line+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <parser_emit_char@plt>
jmp    11b0 <code_line+0x70>
mov    -0x8(%rbp),%rdi
call   1040 <consume@plt>
jmp    114c <code_line+0xc>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code_line>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xeb1(%rip),%r14
lea    0xeaf(%rip),%r15
jmp    1173 <code_line+0x33>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <parser_emit_string@plt>
mov    %rbx,%rdi
call   1040 <consume@plt>
mov    %rbx,%rdi
call   1030 <next@plt>
cmp    $0x3c,%eax
je     11a0 <code_line+0x60>
cmp    $0x3e,%eax
je     1160 <code_line+0x20>
cmp    $0xa,%eax
je     11a8 <code_line+0x68>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <parser_emit_char@plt>
jmp    116b <code_line+0x2b>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
jmp    1166 <code_line+0x26>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.cymkd_parser = type { i32 }
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
define i32 @code_line(%struct.cymkd_parser* %0) {
%2 = alloca %struct.cymkd_parser*
%3 = alloca i32
store %struct.cymkd_parser* %0, %struct.cymkd_parser** %2
br label %4
4: ; preds = %25, %1
%5 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%6 = call i32 @next(%struct.cymkd_parser* %5)
store i32 %6, i32* %3
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %28
8: ; preds = %4
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 60
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%13 = call i32 @parser_emit_string(%struct.cymkd_parser* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %25
14: ; preds = %8
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 62
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%19 = call i32 @parser_emit_string(%struct.cymkd_parser* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %24
20: ; preds = %14
%21 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%22 = load i32, i32* %3
%23 = call i32 @parser_emit_char(%struct.cymkd_parser* %21, i32 %22)
br label %24
24: ; preds = %20, %17
br label %25
25: ; preds = %24, %11
%26 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%27 = call i32 @consume(%struct.cymkd_parser* %26)
br label %4
28: ; preds = %4
ret i32 1
}

LLVM IR (-O2):
%struct.cymkd_parser = type { i32 }
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
define i32 @code_line(%struct.cymkd_parser* %0) {
br label %2
2: ; preds = %10, %1
%3 = tail call i32 @next(%struct.cymkd_parser* %0)
switch i32 %3, label %8 [
i32 10, label %12
i32 60, label %4
i32 62, label %6
]
4: ; preds = %2
%5 = tail call i32 @parser_emit_string(%struct.cymkd_parser* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = tail call i32 @parser_emit_string(%struct.cymkd_parser* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %2
%9 = tail call i32 @parser_emit_char(%struct.cymkd_parser* %0, i32 %3)
br label %10
10: ; preds = %6, %8, %4
%11 = tail call i32 @consume(%struct.cymkd_parser* %0)
br label %2
12: ; preds = %2
ret i32 1
}