#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 /*<<< orphan*/ printChar(char);
int /*<<< orphan*/ printf(char *);
void handleList(int open) {
  extern char BUFFER[];
  int i, identified;
  if (open == 1)
    printf("<ul");
  else
    printf("</ul");
  i = 1;
  identified = BUFFER[i] == ':' ? 1 : 0;
  if (identified) {
    printf(" id=\"");
    for (i++; BUFFER[i] != ':' && BUFFER[i] != '\0'; ++i)
      printChar(BUFFER[i]);
    printf("\"");
  }
  printf(">\n");
}


x86 assembly (clang, -O0):
<handleList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1146 <handleList+0x26>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <handleList+0x32>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
movslq -0x8(%rbp),%rcx
mov    0x2e84(%rip),%rax
movsbl (%rax,%rcx,1),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x3a,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     120a <handleList+0xea>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rcx
mov    0x2e46(%rip),%rax
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x3a,%ecx
mov    %al,-0xd(%rbp)
je     11cc <handleList+0xac>
movslq -0x8(%rbp),%rcx
mov    0x2e29(%rip),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    11dc <handleList+0xbc>
jmp    11fe <handleList+0xde>
movslq -0x8(%rbp),%rcx
mov    0x2e01(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1040 <printChar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1197 <handleList+0x77>
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
lea    0xdfe(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleList>:
push   %rbx
cmp    $0x1,%edi
lea    0xeb5(%rip),%rax
lea    0xeb2(%rip),%rdi
cmove  %rax,%rdi
call   1050 <printf@plt>
mov    0x2e86(%rip),%rbx
cmpb   $0x3a,0x1(%rbx)
jne    11a3 <handleList+0x63>
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
add    $0x2,%rbx
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
test   %al,%al
je     1199 <handleList+0x59>
cmp    $0x3a,%al
je     1199 <handleList+0x59>
movsbl %al,%edi
call   1060 <printChar@plt>
add    $0x1,%rbx
jmp    1180 <handleList+0x40>
mov    $0x22,%edi
call   1030 <putchar@plt>
lea    0xe65(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"<ul\00"
@.str.1 = [5 x i8] c"</ul\00"
@BUFFER = external global [0 x i8]
@.str.2 = [6 x i8] c" id=\22\00"
@.str.3 = [2 x i8] c"\22\00"
@.str.4 = [3 x i8] c">\0A\00"
define void @handleList(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
store i32 1, i32* %3
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [0 x i8], [0 x i8]* @BUFFER, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 58
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 1, i32 0
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %53
22: ; preds = %11
%23 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %48, %22
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [0 x i8], [0 x i8]* @BUFFER, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 58
br i1 %32, label %33, label %40
33: ; preds = %26
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [0 x i8], [0 x i8]* @BUFFER, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 0
br label %40
40: ; preds = %33, %26
%41 = phi i1 [ false, %26 ], [ %39, %33 ]
br i1 %41, label %42, label %51
42: ; preds = %40
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [0 x i8], [0 x i8]* @BUFFER, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = call i32 @printChar(i8 signext %46)
br label %48
48: ; preds = %42
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %26
51: ; preds = %40
%52 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %51, %11
%54 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"<ul\00"
@.str.1 = [5 x i8] c"</ul\00"
@BUFFER = external global [0 x i8]
@.str.2 = [6 x i8] c" id=\22\00"
@str = [2 x i8] c">\00"
define void @handleList(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
%5 = load i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @BUFFER, i64 0, i64 1)
%6 = icmp eq i8 %5, 58
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %13, %7
%10 = phi i64 [ %15, %13 ], [ 2, %7 ]
%11 = getelementptr inbounds [0 x i8], [0 x i8]* @BUFFER, i64 0, i64 %10
%12 = load i8, i8* %11
switch i8 %12, label %13 [
i8 58, label %16
i8 0, label %16
]
13: ; preds = %9
%14 = tail call i32 @printChar(i8 signext %12)
%15 = add nuw i64 %10, 1
br label %9
16: ; preds = %9, %9
%17 = tail call i32 @putchar(i32 34)
br label %18
18: ; preds = %16, %1
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}