void http_200_ok(client_sock, content_type) int client_sock;
char *content_type;
{
  char *status = "HTTP/1.1 200 OK\r\n";
  char *content_type_;
  content_type_ = (char *)malloc((sizeof(content_type) + 2) * sizeof(char));
  sprintf(content_type_, "%s\r\n", content_type);
  send(client_sock, status, strlen(status) * sizeof(char), 0);
  send(client_sock, content_type_, strlen(content_type_) * sizeof(char), 0);
  send(client_sock, "\r\n", 3, 0);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    %rax,%rdx
shl    $0x0,%rdx
xor    %ecx,%ecx
mov    $0x0,%al
call   1040 <send@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %rax,%rdx
shl    $0x0,%rdx
xor    %ecx,%ecx
mov    $0x0,%al
call   1040 <send@plt>
mov    -0x4(%rbp),%edi
lea    0xe2b(%rip),%rsi
mov    $0x3,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1040 <send@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xeb5(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <sprintf@plt>
lea    0xe8f(%rip),%rsi
mov    $0x11,%edx
mov    %ebp,%edi
xor    %ecx,%ecx
xor    %eax,%eax
call   1040 <send@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
xor    %eax,%eax
call   1040 <send@plt>
lea    0xe6e(%rip),%rsi
mov    %ebp,%edi
mov    $0x3,%edx
xor    %ecx,%ecx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <send@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"HTTP/1.1 200 OK\0D\0A\00"
@.str.1 = [5 x i8] c"%s\0D\0A\00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @http_200_ok(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %5
%7 = call i8* @malloc(i64 10)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = load i8*, i8** %4
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32, i32* %3
%12 = load i8*, i8** %5
%13 = load i8*, i8** %5
%14 = call i64 @strlen(i8* %13)
%15 = mul i64 %14, 1
%16 = call i32 (i32, i8*, i64, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i64, i32, ...)*)(i32 %11, i8* %12, i64 %15, i32 0)
%17 = load i32, i32* %3
%18 = load i8*, i8** %6
%19 = load i8*, i8** %6
%20 = call i64 @strlen(i8* %19)
%21 = mul i64 %20, 1
%22 = call i32 (i32, i8*, i64, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i64, i32, ...)*)(i32 %17, i8* %18, i64 %21, i32 0)
%23 = load i32, i32* %3
%24 = call i32 (i32, i8*, i32, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i32, i32, ...)*)(i32 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"HTTP/1.1 200 OK\0D\0A\00"
@.str.1 = [5 x i8] c"%s\0D\0A\00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @http_200_ok(i32 %0, i8* %1) {
%3 = tail call dereferenceable_or_null(10) i8* @malloc(i64 10)
%4 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = tail call i32 (i32, i8*, i64, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i64, i32, ...)*)(i32 %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 17, i32 0)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%7 = tail call i32 (i32, i8*, i64, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i64, i32, ...)*)(i32 %0, i8* %3, i64 %6, i32 0)
%8 = tail call i32 (i32, i8*, i32, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i32, i32, ...)*)(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 0)
ret void
}