#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*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strlen(char *);
void GenerateHtmlHeader(char *mem, char *data) {
  int len;
  char ln[1000];
  len = (int)strlen(data);
  sprintf(mem, "HTTP/1.1 200 OK\r\n");
  strcat(mem, "Date: Sun, 21 Dec 2003 23:10:01 GMT\r\n");
  strcat(mem, "Server: IRTrans 2.0\r\n");
  strcat(mem, "Mime-Version: 1.0\r\n");
  sprintf(ln, "Content-Type: text/html\r\nContent-Length: %6d\r\n", len);
  strcat(mem, ln);
  strcat(mem, "Expires: Sun, 21 Dec 2003 23:10:01 GMT\r\n");
  strcat(mem, "Cache-control: no-cache\r\n");
  strcat(mem, "\r\n");
  strcat(mem, data);
}


x86 assembly (clang, -O0):
<GenerateHtmlHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <strcat@plt>
lea    -0x400(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x400(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xee6(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7b(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenerateHtmlHeader>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x3e8,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
movups 0xeaa(%rip),%xmm0
movups %xmm0,(%rbx)
movw   $0xa,0x10(%rbx)
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xecf(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcat@plt>
lea    0xedc(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xef6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
add    $0x3e8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"HTTP/1.1 200 OK\0D\0A\00"
@.str.1 = [38 x i8] c"Date: Sun, 21 Dec 2003 23:10:01 GMT\0D\0A\00"
@.str.2 = [22 x i8] c"Server: IRTrans 2.0\0D\0A\00"
@.str.3 = [20 x i8] c"Mime-Version: 1.0\0D\0A\00"
@.str.4 = [47 x i8] c"Content-Type: text/html\0D\0AContent-Length: %6d\0D\0A\00"
@.str.5 = [41 x i8] c"Expires: Sun, 21 Dec 2003 23:10:01 GMT\0D\0A\00"
@.str.6 = [26 x i8] c"Cache-control: no-cache\0D\0A\00"
@.str.7 = [3 x i8] c"\0D\0A\00"
define void @GenerateHtmlHeader(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [1000 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i8*, i8** %3
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %3
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %3
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%16 = load i8*, i8** %3
%17 = call i32 @strcat(i8* %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%19 = load i32, i32* %5
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = load i8*, i8** %3
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%23 = call i32 @strcat(i8* %21, i8* %22)
%24 = load i8*, i8** %3
%25 = call i32 @strcat(i8* %24, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%26 = load i8*, i8** %3
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%28 = load i8*, i8** %3
%29 = call i32 @strcat(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%30 = load i8*, i8** %3
%31 = load i8*, i8** %4
%32 = call i32 @strcat(i8* %30, i8* %31)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"HTTP/1.1 200 OK\0D\0A\00"
@.str.1 = [38 x i8] c"Date: Sun, 21 Dec 2003 23:10:01 GMT\0D\0A\00"
@.str.2 = [22 x i8] c"Server: IRTrans 2.0\0D\0A\00"
@.str.3 = [20 x i8] c"Mime-Version: 1.0\0D\0A\00"
@.str.4 = [47 x i8] c"Content-Type: text/html\0D\0AContent-Length: %6d\0D\0A\00"
@.str.5 = [41 x i8] c"Expires: Sun, 21 Dec 2003 23:10:01 GMT\0D\0A\00"
@.str.6 = [26 x i8] c"Cache-control: no-cache\0D\0A\00"
@.str.7 = [3 x i8] c"\0D\0A\00"
define void @GenerateHtmlHeader(i8* %0, i8* %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%6 = trunc i64 %5 to i32
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(18) %0, i8* align 1 dereferenceable(18) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 18, i1 false)
%7 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %6)
%11 = call i32 @strcat(i8* %0, i8* %4)
%12 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%14 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 @strcat(i8* %0, i8* %1)
ret void
}