#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 *, char *, ...);
int /*<<< orphan*/ puts(char *);
void cgiMakeHiddenVarWithExtra(char *varName, char *string, char *extra) {
  printf("<INPUT TYPE=HIDDEN NAME='%s' VALUE='%s'", varName, string);
  if (extra)
    printf(" %s>\n", extra);
  else
    puts(">");
}


x86 assembly (clang, -O0):
<cgiMakeHiddenVarWithExtra>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     116c <cgiMakeHiddenVarWithExtra+0x4c>
mov    -0x18(%rbp),%rsi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1178 <cgiMakeHiddenVarWithExtra+0x58>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiMakeHiddenVarWithExtra>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbx,%rbx
je     114f <cgiMakeHiddenVarWithExtra+0x2f>
lea    0xee4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
lea    0xed8(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"<INPUT TYPE=HIDDEN NAME='%s' VALUE='%s'\00"
@.str.1 = [6 x i8] c" %s>\0A\00"
@.str.2 = [2 x i8] c">\00"
define void @cgiMakeHiddenVarWithExtra(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8*, i8** %6
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %17
15: ; preds = %3
%16 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"<INPUT TYPE=HIDDEN NAME='%s' VALUE='%s'\00"
@.str.1 = [6 x i8] c" %s>\0A\00"
@.str.2 = [2 x i8] c">\00"
define void @cgiMakeHiddenVarWithExtra(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%5 = icmp eq i8* %2, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %10
8: ; preds = %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
ret void
}