#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ send_header(int /*<<< orphan*/ *, int, char *, char *,
                               char *, int, int);
int /*<<< orphan*/ set_simple_head(int /*<<< orphan*/ *, char *, char *,
                                   int /*<<< orphan*/ *);
void send_response(FILE *f, int status, char *title, char *extra, char *text) {
  send_header(f, status, title, extra, "text/html", -1, -1);
  fprintf(f, "<html>");
  set_simple_head(f, title, text, NULL);
  fprintf(f, "<body>");
  fprintf(f, "<h1>%d - %s</h1>", status, title);
  fprintf(f, "<p>%s\r\n</p>", text);
  fprintf(f, "</body></html>");
}


x86 assembly (clang, -O0):
<send_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe9f(%rip),%r8
mov    $0xffffffff,%r9d
movl   $0xffffffff,(%rsp)
call   1040 <send_header@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <set_simple_head@plt>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_response>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
movl   $0xffffffff,(%rsp)
lea    0xea0(%rip),%r8
mov    $0xffffffff,%r9d
call   1040 <send_header@plt>
lea    0xe98(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
call   1050 <set_simple_head@plt>
lea    0xe76(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xe57(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <fwrite@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"text/html\00"
@.str.1 = [7 x i8] c"<html>\00"
@.str.2 = [7 x i8] c"<body>\00"
@.str.3 = [17 x i8] c"<h1>%d - %s</h1>\00"
@.str.4 = [12 x i8] c"<p>%s\0D\0A</p>\00"
@.str.5 = [15 x i8] c"</body></html>\00"
define void @send_response(i32* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = load i8*, i8** %9
%15 = call i32 @send_header(i32* %11, i32 %12, i8* %13, i8* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 -1, i32 -1)
%16 = load i32*, i32** %6
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32*, i32** %6
%19 = load i8*, i8** %8
%20 = load i8*, i8** %10
%21 = call i32 @set_simple_head(i32* %18, i8* %19, i8* %20, i32* null)
%22 = load i32*, i32** %6
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32*, i32** %6
%25 = load i32, i32* %7
%26 = load i8*, i8** %8
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %25, i8* %26)
%28 = load i32*, i32** %6
%29 = load i8*, i8** %10
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %29)
%31 = load i32*, i32** %6
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"text/html\00"
@.str.1 = [7 x i8] c"<html>\00"
@.str.2 = [7 x i8] c"<body>\00"
@.str.3 = [17 x i8] c"<h1>%d - %s</h1>\00"
@.str.4 = [12 x i8] c"<p>%s\0D\0A</p>\00"
@.str.5 = [15 x i8] c"</body></html>\00"
define void @send_response(i32* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 @send_header(i32* %0, i32 %1, i8* %2, i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 -1, i32 -1)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 6, i64 1, i32* %0)
%8 = tail call i32 @set_simple_head(i32* %0, i8* %2, i8* %4, i32* null)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 6, i64 1, i32* %0)
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %1, i8* %2)
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i64 14, i64 1, i32* %0)
ret void
}