#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 *, ...);
void send_headers(FILE *sock_fd, int status_code, char *status_phrase,
                  char *content_type, int content_length) {
  fprintf(sock_fd, "HTTP/1.0 %d %s\r\n", status_code, status_phrase);
  fprintf(sock_fd, "Content-Type: %s\r\n", content_type);
  fprintf(sock_fd, "Content-Length: %d\r\n", content_length);
  fprintf(sock_fd, "\r\n");
}


x86 assembly (clang, -O0):
<send_headers>:
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    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xebe(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_headers>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%rbp
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xec7(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"HTTP/1.0 %d %s\0D\0A\00"
@.str.1 = [19 x i8] c"Content-Type: %s\0D\0A\00"
@.str.2 = [21 x i8] c"Content-Length: %d\0D\0A\00"
@.str.3 = [3 x i8] c"\0D\0A\00"
define void @send_headers(i32* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %13)
%15 = load i32*, i32** %6
%16 = load i8*, i8** %9
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** %6
%19 = load i32, i32* %10
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %6
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"HTTP/1.0 %d %s\0D\0A\00"
@.str.1 = [19 x i8] c"Content-Type: %s\0D\0A\00"
@.str.2 = [21 x i8] c"Content-Length: %d\0D\0A\00"
@.str.3 = [3 x i8] c"\0D\0A\00"
define void @send_headers(i32* nocapture %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %0)
ret void
}