#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*/ content_type(char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
void header(FILE *client_write, char *file_name) {
  char protocol[] = "HTTP/1.0 200 OK\r\n";
  char server[] = "Tiny Web Server \r\n";
  char con_type[1024];
  char ct[1024];
  strcpy(ct, content_type(file_name));
  sprintf(con_type, "Content-type:%s\r\n\r\n", "text/html");
  fputs(protocol, client_write);
  fputs(server, client_write);
  fputs(con_type, client_write);
}


x86 assembly (clang, -O0):
<header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea0(%rip),%ax
mov    %ax,-0x20(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xea2(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe9f(%rip),%ax
mov    %ax,-0x40(%rbp)
mov    0xe97(%rip),%al
mov    %al,-0x3e(%rbp)
lea    -0x850(%rbp),%rax
mov    %rax,-0x858(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <content_type@plt>
mov    -0x858(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x450(%rbp),%rdi
lea    0xe62(%rip),%rsi
lea    0xe6f(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputs@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputs@plt>
lea    -0x450(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputs@plt>
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<header>:
push   %r14
push   %rbx
sub    $0x848,%rsp
mov    %rdi,%rbx
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0xa,0x10(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0xa0d20,0x2f(%rsp)
mov    %rsi,%rdi
call   1050 <content_type@plt>
lea    0x40(%rsp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    0xea5(%rip),%rsi
lea    0xeb2(%rip),%rdx
lea    0x440(%rsp),%r14
mov    %r14,%rdi
call   1060 <sprintf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
lea    0x20(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
add    $0x848,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.header.protocol = [18 x i8] c"HTTP/1.0 200 OK\0D\0A\00"
@__const.header.server = [19 x i8] c"Tiny Web Server \0D\0A\00"
@.str = [20 x i8] c"Content-type:%s\0D\0A\0D\0A\00"
@.str.1 = [10 x i8] c"text/html\00"
define void @header(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [18 x i8]
%6 = alloca [19 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
store i32* %0, i32** %3
store i8* %1, i8** %4
%9 = bitcast [18 x i8]* %5 to i8*
%10 = bitcast [19 x i8]* %6 to i8*
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @content_type(i8* %12)
%14 = call i32 @strcpy(i8* %11, i32 %13)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%16 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%18 = load i32*, i32** %3
%19 = call i32 @fputs(i8* %17, i32* %18)
%20 = getelementptr inbounds [19 x i8], [19 x i8]* %6, i64 0, i64 0
%21 = load i32*, i32** %3
%22 = call i32 @fputs(i8* %20, i32* %21)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%24 = load i32*, i32** %3
%25 = call i32 @fputs(i8* %23, i32* %24)
ret void
}

LLVM IR (-O2):
@__const.header.protocol = [18 x i8] c"HTTP/1.0 200 OK\0D\0A\00"
@__const.header.server = [19 x i8] c"Tiny Web Server \0D\0A\00"
@.str = [20 x i8] c"Content-type:%s\0D\0A\0D\0A\00"
@.str.1 = [10 x i8] c"text/html\00"
define void @header(i32* nocapture %0, i8* %1) {
%3 = alloca [18 x i8]
%4 = alloca [19 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = tail call i32 @content_type(i8* %1)
%12 = call i32 @strcpy(i8* %10, i32 %11)
%13 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @fputs(i8* %7, i32* %0)
%15 = call i32 @fputs(i8* %8, i32* %0)
%16 = call i32 @fputs(i8* %9, i32* %0)
ret void
}