void jsCalendarInput(char *cInputName, char *cValue, unsigned uMode) {
  char cMode[16] = {""};
  if (!uMode)
    sprintf(cMode, "disabled");
  printf("<input id='%s' class='field_input' type='text' name='%s' value='%s' "
         "size=40 style='display: ;                 vertical-align: middle; ' "
         "%s >\n",
         cInputName, cInputName, cValue, cMode);
  if (uMode) {
    printf("<img date_trigger='1' class='record_button' date_field='%s' "
           "id='date_trigger_%s_501'"
           "src='/images/calendar.gif' onmouseout='swapClass(event); "
           "this.src='/images/calendar.gif'"
           "' onmouseover='swapClass(event); this.src='/images/calendar_mo.gif'"
           "onmousedown='this.style.top = '1px'; this.style.left = '1px''"
           "onmouseup='this.style.top = '0px'; this.style.left = '0px''"
           "style='position: relative; vertical-align: middle; display: ;"
           "' title='Date selector'/>\n",
           cInputName, cInputName);
    printf("<script type='text/javascript'>\n Calendar.setup({\n "
           "inputField     :    '%s',\n "
           "ifFormat : '%%Y-%%m-%%d',\n "
           "button         :    'date_trigger_%s_501',\n "
           "align          :    'bR',\n "
           "singleClick    :    true,\n "
           "weekNumbers    :    false,\n "
           "step           :    1,\n "
           "timeFormat : 12\n });</script>\n",
           cInputName, cInputName);
  } else
    printf("<input type=hidden name='%s' value='%s'>\n", cInputName, cValue);
}


x86 assembly (clang, -O0):
<jsCalendarInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
cmpl   $0x0,-0x14(%rbp)
jne    116f <jsCalendarInput+0x3f>
lea    -0x30(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11c8 <jsCalendarInput+0x98>
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0x109a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <jsCalendarInput+0xae>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0x119d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsCalendarInput>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
test   %edx,%edx
je     1165 <jsCalendarInput+0x55>
lea    0xeda(%rip),%rdi
mov    %rsp,%r8
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf4e(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10f9(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
jmp    119f <jsCalendarInput+0x8f>
movabs $0x64656c6261736964,%rax
6c 65 64
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
lea    0xe8a(%rip),%rdi
mov    %rsp,%r8
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x11db(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"disabled\00"
@.str.1 = [142 x i8] c"<input id='%s' class='field_input' type='text' name='%s' value='%s' size=40 style='display: ; vertical-align: middle; ' %s >\0A\00"
@.str.2 = [447 x i8] c"<img date_trigger='1' class='record_button' date_field='%s' id='date_trigger_%s_501'src='/images/calendar.gif' onmouseout='swapClass(event); this.src='/images/calendar.gif'' onmouseover='swapClass(event); this.src='/images/calendar_mo.gif'onmousedown='this.style.top = '1px'; this.style.left = '1px''onmouseup='this.style.top = '0px'; this.style.left = '0px''style='position: relative; vertical-align: middle; display: ;' title='Date selector'/>\0A\00"
@.str.3 = [286 x i8] c"<script type='text/javascript'>\0A Calendar.setup({\0A inputField : '%s',\0A ifFormat : '%%Y-%%m-%%d',\0A button : 'date_trigger_%s_501',\0A align : 'bR',\0A singleClick : true,\0A weekNumbers : false,\0A step : 1,\0A timeFormat : 12\0A });</script>\0A\00"
@.str.4 = [42 x i8] c"<input type=hidden name='%s' value='%s'>\0A\00"
define void @jsCalendarInput(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [16 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = bitcast [16 x i8]* %7 to i8*
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %11, %3
%15 = load i8*, i8** %4
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16, i8* %17, i8* %18)
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %14
%23 = load i8*, i8** %4
%24 = load i8*, i8** %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([447 x i8], [447 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %24)
%26 = load i8*, i8** %4
%27 = load i8*, i8** %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([286 x i8], [286 x i8]* @.str.3, i64 0, i64 0), i8* %26, i8* %27)
br label %33
29: ; preds = %14
%30 = load i8*, i8** %4
%31 = load i8*, i8** %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %30, i8* %31)
br label %33
33: ; preds = %29, %22
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"disabled\00"
@.str.1 = [142 x i8] c"<input id='%s' class='field_input' type='text' name='%s' value='%s' size=40 style='display: ; vertical-align: middle; ' %s >\0A\00"
@.str.2 = [447 x i8] c"<img date_trigger='1' class='record_button' date_field='%s' id='date_trigger_%s_501'src='/images/calendar.gif' onmouseout='swapClass(event); this.src='/images/calendar.gif'' onmouseover='swapClass(event); this.src='/images/calendar_mo.gif'onmousedown='this.style.top = '1px'; this.style.left = '1px''onmouseup='this.style.top = '0px'; this.style.left = '0px''style='position: relative; vertical-align: middle; display: ;' title='Date selector'/>\0A\00"
@.str.3 = [286 x i8] c"<script type='text/javascript'>\0A Calendar.setup({\0A inputField : '%s',\0A ifFormat : '%%Y-%%m-%%d',\0A button : 'date_trigger_%s_501',\0A align : 'bR',\0A singleClick : true,\0A weekNumbers : false,\0A step : 1,\0A timeFormat : 12\0A });</script>\0A\00"
@.str.4 = [42 x i8] c"<input type=hidden name='%s' value='%s'>\0A\00"
define void @jsCalendarInput(i8* %0, i8* %1, i32 %2) {
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%6 = icmp eq i32 %2, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %0, i8* %1, i8* %5)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %1)
br label %14
10: ; preds = %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %0, i8* %1, i8* %5)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([447 x i8], [447 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %0)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([286 x i8], [286 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %0)
br label %14
14: ; preds = %7, %10
ret void
}