#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 */

/* Variables and functions */
int eol(char *);
int /*<<< orphan*/ inner(char *, int);
int list(char *);
int /*<<< orphan*/ outs(char *, int);
int render_list(char *s) {
  int i = list(s);
  if (!i)
    return 0;
  outs("<li>", 4);
  inner(s + 2, i - 2);
  outs("</li>\n", 6);
  return i + eol(s + i);
}


x86 assembly (clang, -O0):
<render_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <list@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    116e <render_list+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    11c3 <render_list+0x83>
lea    0xe8b(%rip),%rdi
mov    $0x4,%esi
call   1060 <outs@plt>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x14(%rbp),%esi
sub    $0x2,%esi
call   1030 <inner@plt>
lea    0xe6c(%rip),%rdi
mov    $0x6,%esi
call   1060 <outs@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1050 <eol@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_list>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <list@plt>
test   %eax,%eax
je     118f <render_list+0x4f>
mov    %eax,%ebx
lea    0xea7(%rip),%rdi
mov    $0x4,%esi
call   1060 <outs@plt>
lea    0x2(%r14),%rdi
lea    -0x2(%rbx),%esi
call   1030 <inner@plt>
lea    0xe8f(%rip),%rdi
mov    $0x6,%esi
call   1060 <outs@plt>
movslq %ebx,%rdi
add    %r14,%rdi
call   1050 <eol@plt>
add    %ebx,%eax
jmp    1191 <render_list+0x51>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"<li>\00"
@.str.1 = [7 x i8] c"</li>\0A\00"
define i32 @render_list(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @list(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 0, i32* %2
br label %25
10: ; preds = %1
%11 = call i32 @outs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 2
%16 = call i32 @inner(i8* %13, i32 %15)
%17 = call i32 @outs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%18 = load i32, i32* %4
%19 = load i8*, i8** %3
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = call i32 @eol(i8* %22)
%24 = add nsw i32 %18, %23
store i32 %24, i32* %2
br label %25
25: ; preds = %10, %9
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [5 x i8] c"<li>\00"
@.str.1 = [7 x i8] c"</li>\0A\00"
define i32 @render_list(i8* %0) {
%2 = tail call i32 @list(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i32 @outs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = add nsw i32 %2, -2
%8 = tail call i32 @inner(i8* %6, i32 %7)
%9 = tail call i32 @outs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = tail call i32 @eol(i8* %11)
%13 = add nsw i32 %12, %2
br label %14
14: ; preds = %1, %4
%15 = phi i32 [ %13, %4 ], [ 0, %1 ]
ret i32 %15
}