#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 */
char *copy_str_dynamic(char *);
int /*<<< orphan*/ sprintf(char *, char const *, char *, char *, char *);
char *generate_html_error_page(char *header, char *error_message) {
  char buffer[2001];
  char *tmp;
  {
    sprintf(
        (char *__restrict)(buffer),
        (char const
             *__restrict)"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 "
                         "Transitional//EN\" "
                         "\"http://www.w3.org/TR/xhtml1/DTD/"
                         "xhtml1-transitional.dtd\">\n<html "
                         "xmlns=\"http://www.w3.org/1999/"
                         "xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" "
                         "content=\"text/html; charset=utf-8\" "
                         "/>\n<title>%s</title>\n</head>\n<body><h1>%s</"
                         "h1><p>%s</p></body></html>",
        header, header, error_message);
    tmp = copy_str_dynamic(buffer);
    return (tmp);
  }
}


x86 assembly (clang, -O0):
<generate_html_error_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x7f0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xeb3(%rip),%rsi
call   1030 <sprintf@plt>
lea    -0x7f0(%rbp),%rdi
call   1040 <copy_str_dynamic@plt>
mov    %rax,-0x7f8(%rbp)
mov    -0x7f8(%rbp),%rax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_html_error_page>:
push   %rbx
sub    $0x7e0,%rsp
mov    %rsi,%r8
mov    %rdi,%rcx
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rcx,%rdx
call   1030 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <copy_str_dynamic@plt>
add    $0x7e0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [310 x i8] c"<!DOCTYPE html PUBLIC \22-//W3C//DTD XHTML 1.0 Transitional//EN\22 \22http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\22>\0A<html xmlns=\22http://www.w3.org/1999/xhtml\22>\0A<head>\0A<meta http-equiv=\22Content-Type\22 content=\22text/html; charset=utf-8\22 />\0A<title>%s</title>\0A</head>\0A<body><h1>%s</h1><p>%s</p></body></html>\00"
define i8* @generate_html_error_page(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [2001 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [2001 x i8], [2001 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([310 x i8], [310 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
%12 = getelementptr inbounds [2001 x i8], [2001 x i8]* %5, i64 0, i64 0
%13 = call i8* @copy_str_dynamic(i8* %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
ret i8* %14
}

LLVM IR (-O2):
@.str = [310 x i8] c"<!DOCTYPE html PUBLIC \22-//W3C//DTD XHTML 1.0 Transitional//EN\22 \22http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\22>\0A<html xmlns=\22http://www.w3.org/1999/xhtml\22>\0A<head>\0A<meta http-equiv=\22Content-Type\22 content=\22text/html; charset=utf-8\22 />\0A<title>%s</title>\0A</head>\0A<body><h1>%s</h1><p>%s</p></body></html>\00"
define i8* @generate_html_error_page(i8* %0, i8* %1) {
%3 = alloca [2001 x i8]
%4 = getelementptr inbounds [2001 x i8], [2001 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([310 x i8], [310 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0, i8* %1)
%6 = call i8* @copy_str_dynamic(i8* %4)
ret i8* %6
}