#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 */

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void ok200(int cliFd) {
  char buff[512];
  bzero(buff, 512);
  sprintf(buff, "%s\r\n%s\r\n%s\r\n\r\n", "HTTP/1.1 200 OK",
          "Server: frihttp 1.0 (linux)", "Connection: Closed");
  write(cliFd, buff, strlen(buff));
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x210(%rbp),%rdi
mov    $0x200,%esi
call   1050 <bzero@plt>
lea    -0x210(%rbp),%rdi
lea    0xe93(%rip),%rsi
lea    0xe9b(%rip),%rdx
lea    0xea4(%rip),%rcx
lea    0xeb9(%rip),%r8
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x21c(%rbp)
lea    -0x210(%rbp),%rax
mov    %rax,-0x218(%rbp)
lea    -0x210(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x21c(%rbp),%edi
mov    -0x218(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
sub    $0x208,%rsp
mov    %edi,%ebp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
call   1050 <bzero@plt>
lea    0xe9e(%rip),%rsi
lea    0xea6(%rip),%rdx
lea    0xeaf(%rip),%rcx
lea    0xec4(%rip),%r8
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x208,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%s\0D\0A%s\0D\0A%s\0D\0A\0D\0A\00"
@.str.1 = [16 x i8] c"HTTP/1.1 200 OK\00"
@.str.2 = [28 x i8] c"Server: frihttp 1.0 (linux)\00"
@.str.3 = [19 x i8] c"Connection: Closed\00"
define void @ok200(i32 %0) {
%2 = alloca i32
%3 = alloca [512 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 @bzero(i8* %4, i32 512)
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @write(i32 %8, i8* %9, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s\0D\0A%s\0D\0A%s\0D\0A\0D\0A\00"
@.str.1 = [16 x i8] c"HTTP/1.1 200 OK\00"
@.str.2 = [28 x i8] c"Server: frihttp 1.0 (linux)\00"
@.str.3 = [19 x i8] c"Connection: Closed\00"
define void @ok200(i32 %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = call i32 @bzero(i8* %3, i32 512)
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @write(i32 %0, i8* %3, i32 %6)
ret void
}