int sendbad(fd, info, err)
int fd;
char *info;
int err;
{
  int i;
  i = sendheader(fd, info, err);
  if (i < 0)
    return (i);
  sprintf(info, "text/html; charset=iso-8859-1\r\n\r\n<!DOCTYPE HTML PUBLIC "
                "\"-//IETF//DTD HTML 2.0//EN\">\n<HTML><HEAD><TITLE>");
  i = senddata(fd, info, strlen(info));
  if (i < 0)
    return (i);
  sprintf(info, "</TITLE></HEAD><BODY>\n<H1>");
  i = senddata(fd, info, strlen(info));
  if (i < 0)
    return (i);
  if (err == 414) {
    sprintf(info, "</H1>\"%s\"<P>\n%s<P>\n</BODY></HTML>\n",
            "Request-URI Too Long", "The URI information is to long.");
  }
  if (err == 404) {
    sprintf(info, "</H1>\"%s\"<P>\n%s<P>\n</BODY></HTML>\n", "Not Found",
            "File Does not exist on this server.");
  }
  if (err == 400) {
    sprintf(
        info, "</H1>\"%s\"<P>\n%s<P>\n</BODY></HTML>\n", "Bad Request",
        "Your browser sent a request that this server could not understand.");
  }
  i = senddata(fd, info, strlen(info));
  return (i);
}


x86 assembly (clang, -O0):
<sendbad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1040 <sendheader@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    117b <sendbad+0x3b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12d7 <sendbad+0x197>
mov    -0x10(%rbp),%rdi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
mov    $0x0,%al
call   1030 <senddata@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    11cd <sendbad+0x8d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12d7 <sendbad+0x197>
mov    -0x10(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    %rax,%rdx
mov    $0x0,%al
call   1030 <senddata@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    121f <sendbad+0xdf>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12d7 <sendbad+0x197>
cmpl   $0x19e,-0x14(%rbp)
jne    124c <sendbad+0x10c>
mov    -0x10(%rbp),%rdi
lea    0xe4c(%rip),%rsi
lea    0xe68(%rip),%rdx
lea    0xe76(%rip),%rcx
mov    $0x0,%al
call   1060 <sprintf@plt>
cmpl   $0x194,-0x14(%rbp)
jne    1279 <sendbad+0x139>
mov    -0x10(%rbp),%rdi
lea    0xe1f(%rip),%rsi
lea    0xe70(%rip),%rdx
lea    0xe73(%rip),%rcx
mov    $0x0,%al
call   1060 <sprintf@plt>
cmpl   $0x190,-0x14(%rbp)
jne    12a6 <sendbad+0x166>
mov    -0x10(%rbp),%rdi
lea    0xdf2(%rip),%rsi
lea    0xe71(%rip),%rdx
lea    0xe76(%rip),%rcx
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    %rax,%rdx
mov    $0x0,%al
call   1030 <senddata@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendbad>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%r14d
xor    %eax,%eax
call   1040 <sendheader@plt>
test   %eax,%eax
js     1226 <sendbad+0xe6>
movups 0xeee(%rip),%xmm0
movups %xmm0,0x50(%rbx)
movups 0xed3(%rip),%xmm0
movups %xmm0,0x40(%rbx)
movups 0xeb8(%rip),%xmm0
movups %xmm0,0x30(%rbx)
movups 0xe9d(%rip),%xmm0
movups %xmm0,0x20(%rbx)
movups 0xe82(%rip),%xmm0
movups %xmm0,0x10(%rbx)
movups 0xe67(%rip),%xmm0
movups %xmm0,(%rbx)
movabs $0x3e454c5449543c,%rax
mov    %rax,0x60(%rbx)
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <senddata@plt>
test   %eax,%eax
js     1226 <sendbad+0xe6>
movups 0xea6(%rip),%xmm0
movups %xmm0,0xb(%rbx)
movups 0xe90(%rip),%xmm0
movups %xmm0,(%rbx)
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <senddata@plt>
test   %eax,%eax
js     1226 <sendbad+0xe6>
cmp    $0x190,%ebp
je     122b <sendbad+0xeb>
cmp    $0x194,%ebp
je     1242 <sendbad+0x102>
cmp    $0x19e,%ebp
jne    1261 <sendbad+0x121>
lea    0xe6d(%rip),%rsi
lea    0xe89(%rip),%rdx
lea    0xe97(%rip),%rcx
jmp    1257 <sendbad+0x117>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe51(%rip),%rsi
lea    0xed0(%rip),%rdx
lea    0xed5(%rip),%rcx
jmp    1257 <sendbad+0x117>
lea    0xe3a(%rip),%rsi
lea    0xe8b(%rip),%rdx
lea    0xe8e(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <senddata@plt>

LLVM IR (-O0):
@.str = [104 x i8] c"text/html; charset=iso-8859-1\0D\0A\0D\0A<!DOCTYPE HTML PUBLIC \22-//IETF//DTD HTML 2.0//EN\22>\0A<HTML><HEAD><TITLE>\00"
@.str.1 = [27 x i8] c"</TITLE></HEAD><BODY>\0A<H1>\00"
@.str.2 = [35 x i8] c"</H1>\22%s\22<P>\0A%s<P>\0A</BODY></HTML>\0A\00"
@.str.3 = [21 x i8] c"Request-URI Too Long\00"
@.str.4 = [32 x i8] c"The URI information is to long.\00"
@.str.5 = [10 x i8] c"Not Found\00"
@.str.6 = [36 x i8] c"File Does not exist on this server.\00"
@.str.7 = [12 x i8] c"Bad Request\00"
@.str.8 = [67 x i8] c"Your browser sent a request that this server could not understand.\00"
define i32 @sendbad(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @sendheader to i32 (i32, i8*, i32, ...)*)(i32 %9, i8* %10, i32 %11)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = load i32, i32* %8
store i32 %16, i32* %4
br label %66
17: ; preds = %3
%18 = load i8*, i8** %6
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* %5
%21 = load i8*, i8** %6
%22 = load i8*, i8** %6
%23 = call i64 @strlen(i8* %22)
%24 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @senddata to i32 (i32, i8*, i64, ...)*)(i32 %20, i8* %21, i64 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %17
%28 = load i32, i32* %8
store i32 %28, i32* %4
br label %66
29: ; preds = %17
%30 = load i8*, i8** %6
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%32 = load i32, i32* %5
%33 = load i8*, i8** %6
%34 = load i8*, i8** %6
%35 = call i64 @strlen(i8* %34)
%36 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @senddata to i32 (i32, i8*, i64, ...)*)(i32 %32, i8* %33, i64 %35)
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %29
%40 = load i32, i32* %8
store i32 %40, i32* %4
br label %66
41: ; preds = %29
%42 = load i32, i32* %7
%43 = icmp eq i32 %42, 414
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i8*, i8** %6
%46 = call i32 (i8*, i8*, ...) @sprintf(i8* %45, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %44, %41
%48 = load i32, i32* %7
%49 = icmp eq i32 %48, 404
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i8*, i8** %6
%52 = call i32 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
br label %53
53: ; preds = %50, %47
%54 = load i32, i32* %7
%55 = icmp eq i32 %54, 400
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i8*, i8** %6
%58 = call i32 (i8*, i8*, ...) @sprintf(i8* %57, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.8, i64 0, i64 0))
br label %59
59: ; preds = %56, %53
%60 = load i32, i32* %5
%61 = load i8*, i8** %6
%62 = load i8*, i8** %6
%63 = call i64 @strlen(i8* %62)
%64 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @senddata to i32 (i32, i8*, i64, ...)*)(i32 %60, i8* %61, i64 %63)
store i32 %64, i32* %8
%65 = load i32, i32* %8
store i32 %65, i32* %4
br label %66
66: ; preds = %59, %39, %27, %15
%67 = load i32, i32* %4
ret i32 %67
}

LLVM IR (-O2):
@.str = [104 x i8] c"text/html; charset=iso-8859-1\0D\0A\0D\0A<!DOCTYPE HTML PUBLIC \22-//IETF//DTD HTML 2.0//EN\22>\0A<HTML><HEAD><TITLE>\00"
@.str.1 = [27 x i8] c"</TITLE></HEAD><BODY>\0A<H1>\00"
@.str.2 = [35 x i8] c"</H1>\22%s\22<P>\0A%s<P>\0A</BODY></HTML>\0A\00"
@.str.3 = [21 x i8] c"Request-URI Too Long\00"
@.str.4 = [32 x i8] c"The URI information is to long.\00"
@.str.5 = [10 x i8] c"Not Found\00"
@.str.6 = [36 x i8] c"File Does not exist on this server.\00"
@.str.7 = [12 x i8] c"Bad Request\00"
@.str.8 = [67 x i8] c"Your browser sent a request that this server could not understand.\00"
define i32 @sendbad(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @sendheader to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %24, label %6
6: ; preds = %3
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(104) %1, i8* align 1 dereferenceable(104) getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i64 104, i1 false)
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @senddata to i32 (i32, i8*, i64, ...)*)(i32 %0, i8* %1, i64 %7)
%9 = icmp slt i32 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %6
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(27) %1, i8* align 1 dereferenceable(27) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 27, i1 false)
%11 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%12 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @senddata to i32 (i32, i8*, i64, ...)*)(i32 %0, i8* %1, i64 %11)
%13 = icmp slt i32 %12, 0
br i1 %13, label %24, label %14
14: ; preds = %10
switch i32 %2, label %21 [
i32 414, label %15
i32 404, label %17
i32 400, label %19
]
15: ; preds = %14
%16 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %21
17: ; preds = %14
%18 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
br label %21
19: ; preds = %14
%20 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.8, i64 0, i64 0))
br label %21
21: ; preds = %17, %15, %14, %19
%22 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%23 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @senddata to i32 (i32, i8*, i64, ...)*)(i32 %0, i8* %1, i64 %22)
br label %24
24: ; preds = %10, %6, %3, %21
%25 = phi i32 [ %23, %21 ], [ %4, %3 ], [ %8, %6 ], [ %12, %10 ]
ret i32 %25
}