#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 remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
void deleteOption(char *stream, char *connection, char *contenttype,
                  char *requestitem) {
  int errorflag;
  errorflag = remove(requestitem);
  if (errorflag == 0) {
    sprintf(stream, "HTTP/1.1 204 No Content\r\n");
    sprintf(stream, "%sServer: My_server\r\n", stream);
    sprintf(stream, "%sContent-Length: 17\r\n", stream);
    sprintf(stream, "%sConnection: %s\r\n", stream, connection);
    sprintf(stream, "%sContent-Type: %s\r\n", stream, contenttype);
    sprintf(stream, "%s\r\n", stream);
    sprintf(stream, "%sDocument deleted\n", stream);
  } else {
    sprintf(stream, "HTTP/1.1 404 Not Found\r\n");
    sprintf(stream, "%sServer: My_server\r\n", stream);
    sprintf(stream, "%sContent-Length: 20\r\n", stream);
    sprintf(stream, "%sConnection: %s\r\n", stream, connection);
    sprintf(stream, "%sContent-Type: %s\r\n", stream, contenttype);
    sprintf(stream, "%s\r\n", stream);
    sprintf(stream, "%sDocument not found!\n", stream);
  }
}


x86 assembly (clang, -O0):
<deleteOption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <remove@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11f1 <deleteOption+0xd1>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    128f <deleteOption+0x16f>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe05(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdf8(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteOption>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rcx,%rdi
call   1030 <remove@plt>
test   %eax,%eax
je     1163 <deleteOption+0x43>
movups 0xf47(%rip),%xmm0
movups %xmm0,0x9(%rbx)
movups 0xf33(%rip),%xmm0
movups %xmm0,(%rbx)
lea    0xf59(%rip),%r15
lea    0xf3b(%rip),%r13
jmp    1186 <deleteOption+0x66>
movups 0xea0(%rip),%xmm0
movups %xmm0,0xa(%rbx)
movups 0xe8b(%rip),%xmm0
movups %xmm0,(%rbx)
lea    0xef0(%rip),%r15
lea    0xeaa(%rip),%r13
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <sprintf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"HTTP/1.1 204 No Content\0D\0A\00"
@.str.1 = [22 x i8] c"%sServer: My_server\0D\0A\00"
@.str.2 = [23 x i8] c"%sContent-Length: 17\0D\0A\00"
@.str.3 = [19 x i8] c"%sConnection: %s\0D\0A\00"
@.str.4 = [21 x i8] c"%sContent-Type: %s\0D\0A\00"
@.str.5 = [5 x i8] c"%s\0D\0A\00"
@.str.6 = [20 x i8] c"%sDocument deleted\0A\00"
@.str.7 = [25 x i8] c"HTTP/1.1 404 Not Found\0D\0A\00"
@.str.8 = [23 x i8] c"%sContent-Length: 20\0D\0A\00"
@.str.9 = [23 x i8] c"%sDocument not found!\0A\00"
define void @deleteOption(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = call i32 @remove(i8* %10)
store i32 %11, i32* %9
%12 = load i32, i32* %9
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %37
14: ; preds = %4
%15 = load i8*, i8** %5
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %5
%18 = load i8*, i8** %5
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %5
%21 = load i8*, i8** %5
%22 = call i32 (i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** %5
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %24, i8* %25)
%27 = load i8*, i8** %5
%28 = load i8*, i8** %5
%29 = load i8*, i8** %7
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %27, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %28, i8* %29)
%31 = load i8*, i8** %5
%32 = load i8*, i8** %5
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %32)
%34 = load i8*, i8** %5
%35 = load i8*, i8** %5
%36 = call i32 (i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %35)
br label %60
37: ; preds = %4
%38 = load i8*, i8** %5
%39 = call i32 (i8*, i8*, ...) @sprintf(i8* %38, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%40 = load i8*, i8** %5
%41 = load i8*, i8** %5
%42 = call i32 (i8*, i8*, ...) @sprintf(i8* %40, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %5
%44 = load i8*, i8** %5
%45 = call i32 (i8*, i8*, ...) @sprintf(i8* %43, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* %44)
%46 = load i8*, i8** %5
%47 = load i8*, i8** %5
%48 = load i8*, i8** %6
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* %46, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %47, i8* %48)
%50 = load i8*, i8** %5
%51 = load i8*, i8** %5
%52 = load i8*, i8** %7
%53 = call i32 (i8*, i8*, ...) @sprintf(i8* %50, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %51, i8* %52)
%54 = load i8*, i8** %5
%55 = load i8*, i8** %5
%56 = call i32 (i8*, i8*, ...) @sprintf(i8* %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %55)
%57 = load i8*, i8** %5
%58 = load i8*, i8** %5
%59 = call i32 (i8*, i8*, ...) @sprintf(i8* %57, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %37, %14
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"HTTP/1.1 204 No Content\0D\0A\00"
@.str.1 = [22 x i8] c"%sServer: My_server\0D\0A\00"
@.str.2 = [23 x i8] c"%sContent-Length: 17\0D\0A\00"
@.str.3 = [19 x i8] c"%sConnection: %s\0D\0A\00"
@.str.4 = [21 x i8] c"%sContent-Type: %s\0D\0A\00"
@.str.5 = [5 x i8] c"%s\0D\0A\00"
@.str.6 = [20 x i8] c"%sDocument deleted\0A\00"
@.str.7 = [25 x i8] c"HTTP/1.1 404 Not Found\0D\0A\00"
@.str.8 = [23 x i8] c"%sContent-Length: 20\0D\0A\00"
@.str.9 = [23 x i8] c"%sDocument not found!\0A\00"
define void @deleteOption(i8* %0, i8* %1, i8* %2, i8* nocapture %3) {
%5 = tail call i32 @remove(i8* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(26) %0, i8* align 1 dereferenceable(26) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 26, i1 false)
br label %9
8: ; preds = %4
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(25) %0, i8* align 1 dereferenceable(25) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i64 25, i1 false)
br label %9
9: ; preds = %8, %7
%10 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), %8 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), %7 ]
%11 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %8 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), %7 ]
%12 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%13 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) %10, i8* %0)
%14 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %1)
%15 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %2)
%16 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%17 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) %11, i8* %0)
ret void
}