#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*/ time_buf;
typedef int /*<<< orphan*/ num_len;

/* Variables and functions */
char *get_time_str(char *);
int /*<<< orphan*/ memcpy(unsigned char *, ...);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int strlen(char *);
int reply_normal_information(unsigned char *send_buf, unsigned char *file_buf,
                             int file_size, char *mime_type) {
  char *str = "HTTP/1.1 200 OK\r\nServer:Mutu/Linux(0.1)\r\nDate:";
  register int index = strlen(str);
  memcpy(send_buf, str, index);
  char time_buf[40];
  memset(time_buf, '\0', sizeof(time_buf));
  str = get_time_str(time_buf);
  int len = strlen(time_buf);
  memcpy(send_buf + index, time_buf, len);
  index += len;
  len = strlen("Allow:GET");
  memcpy(send_buf + index, "Allow:GET", len);
  index += len;
  memcpy(send_buf + index, "\r\nContent-Type:", 15);
  index += 15;
  len = strlen(mime_type);
  memcpy(send_buf + index, mime_type, len);
  index += strlen(mime_type);
  memcpy(send_buf + index, "\r\nContent-Length:", 17);
  index += 17;
  char num_len[8];
  memset(num_len, '\0', sizeof(num_len));
  sprintf(num_len, "%d", file_size);
  len = strlen(num_len);
  memcpy(send_buf + index, num_len, len);
  index += len;
  memcpy(send_buf + index, "\r\n\r\n", 4);
  index += 4;
  memcpy(send_buf + index, file_buf, file_size);
  index += file_size;
  return index;
}


x86 assembly (clang, -O0):
<reply_normal_information>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xe92(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    -0x60(%rbp),%rdi
call   1060 <get_time_str@plt>
mov    %rax,-0x28(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
lea    -0x60(%rbp),%rsi
mov    -0x64(%rbp),%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    -0x64(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    0xe4d(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x64(%rbp),%edx
lea    0xe30(%rip),%rsi
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    -0x64(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
lea    0xe18(%rip),%rsi
xor    %eax,%eax
mov    $0xf,%edx
call   1050 <memcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x64(%rbp),%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
lea    0xdcd(%rip),%rsi
xor    %eax,%eax
mov    $0x11,%edx
call   1050 <memcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x11,%eax
mov    %eax,-0x2c(%rbp)
lea    -0x6c(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
lea    -0x6c(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xdac(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x6c(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
lea    -0x6c(%rbp),%rsi
mov    -0x64(%rbp),%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    -0x64(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
lea    0xd6a(%rip),%rsi
xor    %eax,%eax
mov    $0x4,%edx
call   1050 <memcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    -0x14(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reply_normal_information>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%r12
mov    %rdx,0x8(%rsp)
mov    %rsi,0x10(%rsp)
mov    %rdi,%r15
lea    0xe8b(%rip),%r13
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %r13,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
lea    0x20(%rsp),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
mov    %r13,%rdi
call   1060 <get_time_str@plt>
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
movslq %ebp,%rbx
lea    (%r15,%rbx,1),%rdi
mov    %r13,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
add    %r14d,%ebx
lea    0xe5d(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
movslq %ebx,%rbx
lea    (%r15,%rbx,1),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
add    %ebp,%ebx
movslq %ebx,%rbx
lea    (%r15,%rbx,1),%rdi
lea    0xe3a(%rip),%rsi
mov    $0xf,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rbx,1),%rdi
add    $0xf,%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %ebx,%r12d
add    %eax,%r12d
add    %ebx,%eax
add    $0xf,%eax
movslq %eax,%rbx
lea    (%r15,%rbx,1),%rdi
lea    0xe01(%rip),%rsi
mov    $0x11,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
lea    0x18(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
lea    0xdec(%rip),%rsi
mov    %r14,%rdi
mov    0x8(%rsp),%r13
mov    %r13d,%edx
call   1070 <sprintf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    (%r12,%rbp,1),%eax
add    $0xf,%eax
mov    %rax,(%rsp)
lea    (%r15,%rbx,1),%rdi
add    $0x11,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
lea    (%r12,%rbp,1),%eax
add    $0x20,%eax
movslq %eax,%rbx
lea    (%r15,%rbx,1),%rdi
lea    0xda1(%rip),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
lea    (%r15,%rbx,1),%rdi
add    $0x4,%rdi
mov    0x10(%rsp),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1050 <memcpy@plt>
mov    (%rsp),%rax
add    %r13d,%eax
add    $0x15,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"HTTP/1.1 200 OK\0D\0AServer:Mutu/Linux(0.1)\0D\0ADate:\00"
@.str.1 = [10 x i8] c"Allow:GET\00"
@.str.2 = [16 x i8] c"\0D\0AContent-Type:\00"
@.str.3 = [18 x i8] c"\0D\0AContent-Length:\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [5 x i8] c"\0D\0A\0D\0A\00"
define i32 @reply_normal_information(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [40 x i8]
%12 = alloca i32
%13 = alloca [8 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8** %9
%14 = load i8*, i8** %9
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %10
%16 = load i8*, i8** %5
%17 = load i8*, i8** %9
%18 = load i32, i32* %10
%19 = call i32 (i8*, ...) @memcpy(i8* %16, i8* %17, i32 %18)
%20 = getelementptr inbounds [40 x i8], [40 x i8]* %11, i64 0, i64 0
%21 = call i32 @memset(i8* %20, i8 signext 0, i32 40)
%22 = getelementptr inbounds [40 x i8], [40 x i8]* %11, i64 0, i64 0
%23 = call i8* @get_time_str(i8* %22)
store i8* %23, i8** %9
%24 = getelementptr inbounds [40 x i8], [40 x i8]* %11, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
store i32 %25, i32* %12
%26 = load i8*, i8** %5
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = getelementptr inbounds [40 x i8], [40 x i8]* %11, i64 0, i64 0
%31 = load i32, i32* %12
%32 = call i32 (i8*, ...) @memcpy(i8* %29, i8* %30, i32 %31)
%33 = load i32, i32* %12
%34 = load i32, i32* %10
%35 = add nsw i32 %34, %33
store i32 %35, i32* %10
%36 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 %36, i32* %12
%37 = load i8*, i8** %5
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i32, i32* %12
%42 = call i32 (i8*, ...) @memcpy(i8* %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %12
%44 = load i32, i32* %10
%45 = add nsw i32 %44, %43
store i32 %45, i32* %10
%46 = load i8*, i8** %5
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = call i32 (i8*, ...) @memcpy(i8* %49, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 15
store i32 %52, i32* %10
%53 = load i8*, i8** %8
%54 = call i32 @strlen(i8* %53)
store i32 %54, i32* %12
%55 = load i8*, i8** %5
%56 = load i32, i32* %10
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8*, i8** %8
%60 = load i32, i32* %12
%61 = call i32 (i8*, ...) @memcpy(i8* %58, i8* %59, i32 %60)
%62 = load i8*, i8** %8
%63 = call i32 @strlen(i8* %62)
%64 = load i32, i32* %10
%65 = add nsw i32 %64, %63
store i32 %65, i32* %10
%66 = load i8*, i8** %5
%67 = load i32, i32* %10
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = call i32 (i8*, ...) @memcpy(i8* %69, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 17)
%71 = load i32, i32* %10
%72 = add nsw i32 %71, 17
store i32 %72, i32* %10
%73 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%74 = call i32 @memset(i8* %73, i8 signext 0, i32 8)
%75 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%76 = load i32, i32* %7
%77 = call i32 @sprintf(i8* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %76)
%78 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%79 = call i32 @strlen(i8* %78)
store i32 %79, i32* %12
%80 = load i8*, i8** %5
%81 = load i32, i32* %10
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %80, i64 %82
%84 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%85 = load i32, i32* %12
%86 = call i32 (i8*, ...) @memcpy(i8* %83, i8* %84, i32 %85)
%87 = load i32, i32* %12
%88 = load i32, i32* %10
%89 = add nsw i32 %88, %87
store i32 %89, i32* %10
%90 = load i8*, i8** %5
%91 = load i32, i32* %10
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %90, i64 %92
%94 = call i32 (i8*, ...) @memcpy(i8* %93, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%95 = load i32, i32* %10
%96 = add nsw i32 %95, 4
store i32 %96, i32* %10
%97 = load i8*, i8** %5
%98 = load i32, i32* %10
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %97, i64 %99
%101 = load i8*, i8** %6
%102 = load i32, i32* %7
%103 = call i32 (i8*, ...) @memcpy(i8* %100, i8* %101, i32 %102)
%104 = load i32, i32* %7
%105 = load i32, i32* %10
%106 = add nsw i32 %105, %104
store i32 %106, i32* %10
%107 = load i32, i32* %10
ret i32 %107
}

LLVM IR (-O2):
@.str = [47 x i8] c"HTTP/1.1 200 OK\0D\0AServer:Mutu/Linux(0.1)\0D\0ADate:\00"
@.str.1 = [10 x i8] c"Allow:GET\00"
@.str.2 = [16 x i8] c"\0D\0AContent-Type:\00"
@.str.3 = [18 x i8] c"\0D\0AContent-Length:\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [5 x i8] c"\0D\0A\0D\0A\00"
define i32 @reply_normal_information(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [40 x i8]
%6 = alloca [8 x i8]
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @memcpy(i8* %0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [40 x i8], [40 x i8]* %5, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i8 signext 0, i32 40)
%11 = call i8* @get_time_str(i8* %9)
%12 = call i32 @strlen(i8* %9)
%13 = sext i32 %7 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = call i32 (i8*, ...) @memcpy(i8* %14, i8* %9, i32 %12)
%16 = add nsw i32 %12, %7
%17 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = call i32 (i8*, ...) @memcpy(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%21 = add nsw i32 %17, %16
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = call i32 (i8*, ...) @memcpy(i8* %23, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
%25 = add nsw i32 %21, 15
%26 = call i32 @strlen(i8* %3)
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i8, i8* %0, i64 %27
%29 = call i32 (i8*, ...) @memcpy(i8* %28, i8* %3, i32 %26)
%30 = call i32 @strlen(i8* %3)
%31 = add nsw i32 %30, %25
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %0, i64 %32
%34 = call i32 (i8*, ...) @memcpy(i8* %33, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 17)
%35 = add nsw i32 %31, 17
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%37 = call i32 @memset(i8* %36, i8 signext 0, i32 8)
%38 = call i32 @sprintf(i8* %36, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %2)
%39 = call i32 @strlen(i8* %36)
%40 = sext i32 %35 to i64
%41 = getelementptr inbounds i8, i8* %0, i64 %40
%42 = call i32 (i8*, ...) @memcpy(i8* %41, i8* %36, i32 %39)
%43 = add nsw i32 %39, %35
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %0, i64 %44
%46 = call i32 (i8*, ...) @memcpy(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%47 = add nsw i32 %43, 4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %0, i64 %48
%50 = call i32 (i8*, ...) @memcpy(i8* %49, i8* %1, i32 %2)
%51 = add nsw i32 %47, %2
ret i32 %51
}