#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printStrAt(int /*<<< orphan*/ *, int, int, char *);
int sprintf(char *, char *, int, char *);
void addList(WINDOW *window, int xloc, int yloc, int num, char *strArray[]) {
  int index;
  char strBuffer[128];
  for (int i = 0; i < num; i++) {
    index = i + 1;
    int numInBuffer = sprintf(strBuffer, "    %i. %s", index, strArray[i]);
    assert(numInBuffer > 0);
    printStrAt(window, xloc, yloc + i, strBuffer);
  }
}


x86 assembly (clang, -O0):
<addList>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e0 <addList+0xb0>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe6f(%rip),%rsi
call   1050 <sprintf@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x0,-0xb8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    -0xb4(%rbp),%edx
lea    -0xb0(%rbp),%rcx
call   1040 <printStrAt@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1156 <addList+0x26>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addList>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %esi,0x4(%rsp)
mov    %rdi,0x8(%rsp)
test   %ecx,%ecx
jle    11a6 <addList+0x76>
mov    %r8,%r13
mov    %ecx,%r14d
mov    %edx,%r12d
xor    %ebx,%ebx
lea    0x10(%rsp),%rbp
xchg   %ax,%ax
lea    0x1(%rbx),%r15
mov    0x0(%r13,%rbx,8),%rcx
mov    %rbp,%rdi
lea    0xe8d(%rip),%rsi
mov    %r15d,%edx
call   1050 <sprintf@plt>
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   1030 <assert@plt>
add    %r12d,%ebx
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    %ebx,%edx
mov    %rbp,%rcx
call   1040 <printStrAt@plt>
mov    %r15,%rbx
cmp    %r15,%r14
jne    1160 <addList+0x30>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c" %i. %s\00"
define void @addList(i32* %0, i32 %1, i32 %2, i32 %3, i8** %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i32
%12 = alloca [128 x i8]
%13 = alloca i32
%14 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8** %4, i8*** %10
store i32 0, i32* %13
br label %15
15: ; preds = %41, %5
%16 = load i32, i32* %13
%17 = load i32, i32* %9
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %44
19: ; preds = %15
%20 = load i32, i32* %13
%21 = add nsw i32 %20, 1
store i32 %21, i32* %11
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%23 = load i32, i32* %11
%24 = load i8**, i8*** %10
%25 = load i32, i32* %13
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %23, i8* %28)
store i32 %29, i32* %14
%30 = load i32, i32* %14
%31 = icmp sgt i32 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load i32*, i32** %6
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = load i32, i32* %13
%38 = add nsw i32 %36, %37
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%40 = call i32 @printStrAt(i32* %34, i32 %35, i32 %38, i8* %39)
br label %41
41: ; preds = %19
%42 = load i32, i32* %13
%43 = add nsw i32 %42, 1
store i32 %43, i32* %13
br label %15
44: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c" %i. %s\00"
define void @addList(i32* %0, i32 %1, i32 %2, i32 %3, i8** nocapture %4) {
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = icmp sgt i32 %3, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = zext i32 %3 to i64
br label %12
11: ; preds = %12, %5
ret void
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %14, %12 ]
%14 = add nuw nsw i64 %13, 1
%15 = getelementptr inbounds i8*, i8** %4, i64 %13
%16 = load i8*, i8** %15
%17 = trunc i64 %14 to i32
%18 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %17, i8* %16)
%19 = icmp sgt i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = trunc i64 %13 to i32
%23 = add nsw i32 %22, %2
%24 = call i32 @printStrAt(i32* %0, i32 %1, i32 %23, i8* %7)
%25 = icmp eq i64 %14, %10
br i1 %25, label %11, label %12
}