#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*/ printf(char *, ...);
void set_cookie(char *name, char *value, char *expires, char *path,
                char *domain, short secure) {
  printf("Set-Cookie: %s=%s;", name, value);
  if (expires != NULL)
    printf(" EXPIRES=%s;", expires);
  if (path != NULL)
    printf(" PATH=%s;", path);
  if (domain != NULL)
    printf(" DOMAIN=%s;", domain);
  if (secure)
    printf(" SECURE");
  printf("\n");
}


x86 assembly (clang, -O0):
<set_cookie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r9w,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %ax,-0x2a(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     1167 <set_cookie+0x57>
mov    -0x18(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1184 <set_cookie+0x74>
mov    -0x20(%rbp),%rsi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x28(%rbp)
je     11a1 <set_cookie+0x91>
mov    -0x28(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpw   $0x0,-0x2a(%rbp)
je     11ba <set_cookie+0xaa>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cookie>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r15
mov    %rcx,%rbp
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbx,%rbx
je     115d <set_cookie+0x3d>
lea    0xec0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbp,%rbp
je     1173 <set_cookie+0x53>
lea    0xeb7(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15,%r15
je     1189 <set_cookie+0x69>
lea    0xeab(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14w,%r14w
je     119d <set_cookie+0x7d>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Set-Cookie: %s=%s;\00"
@.str.1 = [13 x i8] c" EXPIRES=%s;\00"
@.str.2 = [10 x i8] c" PATH=%s;\00"
@.str.3 = [12 x i8] c" DOMAIN=%s;\00"
@.str.4 = [8 x i8] c" SECURE\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @set_cookie(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i16 signext %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i16
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i16 %5, i16* %12
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i8*, i8** %9
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %6
%19 = load i8*, i8** %9
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %6
%22 = load i8*, i8** %10
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i8*, i8** %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %24, %21
%28 = load i8*, i8** %11
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i8*, i8** %11
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %30, %27
%34 = load i16, i16* %12
%35 = icmp ne i16 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %33
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Set-Cookie: %s=%s;\00"
@.str.1 = [13 x i8] c" EXPIRES=%s;\00"
@.str.2 = [10 x i8] c" PATH=%s;\00"
@.str.3 = [12 x i8] c" DOMAIN=%s;\00"
@.str.4 = [8 x i8] c" SECURE\00"
define void @set_cookie(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i16 signext %5) {
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = icmp eq i8* %2, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %11
11: ; preds = %9, %6
%12 = icmp eq i8* %3, null
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %15
15: ; preds = %13, %11
%16 = icmp eq i8* %4, null
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %4)
br label %19
19: ; preds = %17, %15
%20 = icmp eq i16 %5, 0
br i1 %20, label %23, label %21
21: ; preds = %19
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = tail call i32 @putchar(i32 10)
ret void
}