#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void MakeCookieHead(char *szHead, char *szName, char *szValue, char *szExpire,
                    char *szPath, char *szDomain, int bSecure) {
  strcpy(szHead, "Set-Cookie: ");
  strcat(szHead, szName);
  strcat(szHead, "=");
  strcat(szHead, szValue);
  strcat(szHead, ";");
  if (szExpire && *szExpire) {
    strcat(szHead, " expires=");
    strcat(szHead, szExpire);
    strcat(szHead, ";");
  }
  if (szPath && *szPath) {
    strcat(szHead, " path=");
    strcat(szHead, szPath);
    strcat(szHead, ";");
  }
  if (szDomain && *szDomain) {
    strcat(szHead, " domain=");
    strcat(szHead, szDomain);
    strcat(szHead, ";");
  }
  if (bSecure) {
    strcat(szHead, " secure");
  }
}


x86 assembly (clang, -O0):
<MakeCookieHead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcat@plt>
cmpq   $0x0,-0x20(%rbp)
je     11d5 <MakeCookieHead+0xb5>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d5 <MakeCookieHead+0xb5>
mov    -0x8(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1040 <strcat@plt>
cmpq   $0x0,-0x28(%rbp)
je     121d <MakeCookieHead+0xfd>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     121d <MakeCookieHead+0xfd>
mov    -0x8(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xdf5(%rip),%rsi
call   1040 <strcat@plt>
cmpq   $0x0,-0x30(%rbp)
je     1265 <MakeCookieHead+0x145>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1265 <MakeCookieHead+0x145>
mov    -0x8(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xdad(%rip),%rsi
call   1040 <strcat@plt>
cmpl   $0x0,0x10(%rbp)
je     127f <MakeCookieHead+0x15f>
mov    -0x8(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1040 <strcat@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeCookieHead>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    0x40(%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0xeb4(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strcat@plt>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strcat@plt>
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
test   %r12,%r12
je     11ba <MakeCookieHead+0x9a>
cmpb   $0x0,(%r12)
je     11ba <MakeCookieHead+0x9a>
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcat@plt>
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
test   %r15,%r15
je     11ee <MakeCookieHead+0xce>
cmpb   $0x0,(%r15)
je     11ee <MakeCookieHead+0xce>
lea    0xe4d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
lea    0xe27(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
test   %r14,%r14
je     1222 <MakeCookieHead+0x102>
cmpb   $0x0,(%r14)
je     1222 <MakeCookieHead+0x102>
lea    0xe20(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
lea    0xdf3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
cmpl   $0x0,0x4(%rsp)
je     1246 <MakeCookieHead+0x126>
lea    0xdf9(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <strcat@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Set-Cookie: \00"
@.str.1 = [2 x i8] c"=\00"
@.str.2 = [2 x i8] c";\00"
@.str.3 = [10 x i8] c" expires=\00"
@.str.4 = [7 x i8] c" path=\00"
@.str.5 = [9 x i8] c" domain=\00"
@.str.6 = [8 x i8] c" secure\00"
define void @MakeCookieHead(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i32 %6, i32* %14
%15 = load i8*, i8** %8
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %8
%18 = load i8*, i8** %9
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %8
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = load i8*, i8** %8
%23 = load i8*, i8** %10
%24 = call i32 @strcat(i8* %22, i8* %23)
%25 = load i8*, i8** %8
%26 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = load i8*, i8** %11
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %42
29: ; preds = %7
%30 = load i8*, i8** %11
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %29
%35 = load i8*, i8** %8
%36 = call i32 @strcat(i8* %35, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%37 = load i8*, i8** %8
%38 = load i8*, i8** %11
%39 = call i32 @strcat(i8* %37, i8* %38)
%40 = load i8*, i8** %8
%41 = call i32 @strcat(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %34, %29, %7
%43 = load i8*, i8** %12
%44 = icmp ne i8* %43, null
br i1 %44, label %45, label %58
45: ; preds = %42
%46 = load i8*, i8** %12
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %58
50: ; preds = %45
%51 = load i8*, i8** %8
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%53 = load i8*, i8** %8
%54 = load i8*, i8** %12
%55 = call i32 @strcat(i8* %53, i8* %54)
%56 = load i8*, i8** %8
%57 = call i32 @strcat(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %50, %45, %42
%59 = load i8*, i8** %13
%60 = icmp ne i8* %59, null
br i1 %60, label %61, label %74
61: ; preds = %58
%62 = load i8*, i8** %13
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %74
66: ; preds = %61
%67 = load i8*, i8** %8
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%69 = load i8*, i8** %8
%70 = load i8*, i8** %13
%71 = call i32 @strcat(i8* %69, i8* %70)
%72 = load i8*, i8** %8
%73 = call i32 @strcat(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %74
74: ; preds = %66, %61, %58
%75 = load i32, i32* %14
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = load i8*, i8** %8
%79 = call i32 @strcat(i8* %78, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %80
80: ; preds = %77, %74
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Set-Cookie: \00"
@.str.1 = [2 x i8] c"=\00"
@.str.2 = [2 x i8] c";\00"
@.str.3 = [10 x i8] c" expires=\00"
@.str.4 = [7 x i8] c" path=\00"
@.str.5 = [9 x i8] c" domain=\00"
@.str.6 = [8 x i8] c" secure\00"
define void @MakeCookieHead(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i32 %6) {
%8 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* %0, i8* %1)
%10 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @strcat(i8* %0, i8* %2)
%12 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i8* %3, null
br i1 %13, label %21, label %14
14: ; preds = %7
%15 = load i8, i8* %3
%16 = icmp eq i8 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%19 = tail call i32 @strcat(i8* %0, i8* %3)
%20 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %17, %14, %7
%22 = icmp eq i8* %4, null
br i1 %22, label %30, label %23
23: ; preds = %21
%24 = load i8, i8* %4
%25 = icmp eq i8 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%28 = tail call i32 @strcat(i8* %0, i8* %4)
%29 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %26, %23, %21
%31 = icmp eq i8* %5, null
br i1 %31, label %39, label %32
32: ; preds = %30
%33 = load i8, i8* %5
%34 = icmp eq i8 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %32
%36 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%37 = tail call i32 @strcat(i8* %0, i8* %5)
%38 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %35, %32, %30
%40 = icmp eq i32 %6, 0
br i1 %40, label %43, label %41
41: ; preds = %39
%42 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
ret void
}