#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*/ memcpy(char *, char *, int);
char *realloc(char *, size_t);
size_t strlen(char *);
void add_index_html(char **sPtr) {
  size_t n = strlen(*sPtr);
  size_t new_size = n + 10;
  *sPtr = realloc(*sPtr, new_size + 1);
  memcpy((*sPtr) + n, "index.html", 10);
  (*sPtr)[n + 10] = '\0';
}


x86 assembly (clang, -O0):
<add_index_html>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1050 <realloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
add    -0x10(%rbp),%rdi
lea    0xe78(%rip),%rsi
mov    $0xa,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,0xa(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_index_html>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rdi),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
lea    0xb(%rax),%rsi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,(%r14)
lea    (%rax,%r15,1),%rdi
lea    0xea0(%rip),%rsi
mov    $0xa,%edx
call   1040 <memcpy@plt>
mov    (%r14),%rax
movb   $0x0,0xa(%r15,%rax,1)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"index.html\00"
define void @add_index_html(i8** %0) {
%2 = alloca i8**
%3 = alloca i64
%4 = alloca i64
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = add i64 %8, 10
store i64 %9, i64* %4
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = load i64, i64* %4
%13 = add i64 %12, 1
%14 = call i8* @realloc(i8* %11, i64 %13)
%15 = load i8**, i8*** %2
store i8* %14, i8** %15
%16 = load i8**, i8*** %2
%17 = load i8*, i8** %16
%18 = load i64, i64* %3
%19 = getelementptr inbounds i8, i8* %17, i64 %18
%20 = call i32 @memcpy(i8* %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10)
%21 = load i8**, i8*** %2
%22 = load i8*, i8** %21
%23 = load i64, i64* %3
%24 = add i64 %23, 10
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 0, i8* %25
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"index.html\00"
define void @add_index_html(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%4 = add i64 %3, 10
%5 = add i64 %3, 11
%6 = tail call i8* @realloc(i8* %2, i64 %5)
store i8* %6, i8** %0
%7 = getelementptr inbounds i8, i8* %6, i64 %3
%8 = tail call i32 @memcpy(i8* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10)
%9 = load i8*, i8** %0
%10 = getelementptr inbounds i8, i8* %9, i64 %4
store i8 0, i8* %10
ret void
}