#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*/ li(int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ system(char *);
void print_list(const char *items, char *heading) {
  system("clear");
  puts(heading);
  int curchar = 0, item_num = 1;
  li(item_num++);
  for (int i = 0; (curchar = items[i]) != '\0'; i++) {
    putchar(curchar);
    if (curchar == '\n')
      li(item_num++);
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1050 <system@plt>
mov    -0x10(%rbp),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
call   1060 <li@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     11da <print_list+0x9a>
mov    -0x14(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
cmpl   $0xa,-0x14(%rbp)
jne    11c7 <print_list+0x87>
mov    -0x18(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
call   1060 <li@plt>
jmp    11cc <print_list+0x8c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118a <print_list+0x4a>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_list>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeaf(%rip),%rdi
call   1050 <system@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1060 <li@plt>
mov    (%rbx),%al
test   %al,%al
je     11ac <print_list+0x6c>
add    $0x1,%rbx
mov    $0x2,%r14d
jmp    118b <print_list+0x4b>
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11ac <print_list+0x6c>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    $0xa,%bpl
jne    1180 <print_list+0x40>
lea    0x1(%r14),%ebp
mov    %r14d,%edi
call   1060 <li@plt>
mov    %ebp,%r14d
jmp    1180 <print_list+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define void @print_list(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %4
%10 = call i32 @puts(i8* %9)
store i32 0, i32* %5
store i32 1, i32* %6
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
store i32 %12, i32* %6
%13 = call i32 @li(i32 %11)
store i32 0, i32* %7
br label %14
14: ; preds = %33, %2
%15 = load i8*, i8** %3
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
store i32 %20, i32* %5
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %36
22: ; preds = %14
%23 = load i32, i32* %5
%24 = trunc i32 %23 to i8
%25 = call i32 @putchar(i8 signext %24)
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %32
28: ; preds = %22
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
%31 = call i32 @li(i32 %29)
br label %32
32: ; preds = %28, %22
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %14
36: ; preds = %14
%37 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @print_list(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) %1)
%5 = tail call i32 @li(i32 1)
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %19, %2
%9 = tail call i32 @putchar(i8 signext 10)
ret void
10: ; preds = %2, %19
%11 = phi i64 [ %21, %19 ], [ 0, %2 ]
%12 = phi i8 [ %23, %19 ], [ %6, %2 ]
%13 = phi i32 [ %20, %19 ], [ 2, %2 ]
%14 = tail call i32 @putchar(i8 signext %12)
%15 = icmp eq i8 %12, 10
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = add nsw i32 %13, 1
%18 = tail call i32 @li(i32 %13)
br label %19
19: ; preds = %10, %16
%20 = phi i32 [ %17, %16 ], [ %13, %10 ]
%21 = add nuw i64 %11, 1
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %8, label %10
}