#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 *, ...);
int strlen(char *);
void cgiMakeDoubleVarInRange(char *varName, double initialVal, char *title,
                             int width, char *min, char *max) {
  if (width == 0) {
    if (max)
      width = strlen(max) * 10;
  }
  if (width < 65)
    width = 65;
  printf("<INPUT TYPE=TEXT class='inputBox' name=\"%s\" style='width: %dpx' "
         "value=%g",
         varName, width, initialVal);
  printf(" onChange='return validateFloat(this,%s,%s);'",
         (min ? min : "\"null\""), (max ? max : "\"null\""));
  if (title)
    printf(" title='%s'", title);
  printf(">\n");
}


x86 assembly (clang, -O0):
<cgiMakeDoubleVarInRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1169 <cgiMakeDoubleVarInRange+0x49>
cmpq   $0x0,-0x30(%rbp)
je     1164 <cgiMakeDoubleVarInRange+0x44>
mov    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
imul   $0xa,%eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1169 <cgiMakeDoubleVarInRange+0x49>
cmpl   $0x41,-0x1c(%rbp)
jge    117a <cgiMakeDoubleVarInRange+0x5a>
movl   $0x41,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x10(%rbp),%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x28(%rbp)
je     11ac <cgiMakeDoubleVarInRange+0x8c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    11bc <cgiMakeDoubleVarInRange+0x9c>
lea    0xec4(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    11bc <cgiMakeDoubleVarInRange+0x9c>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11dc <cgiMakeDoubleVarInRange+0xbc>
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    11ec <cgiMakeDoubleVarInRange+0xcc>
lea    0xe94(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11ec <cgiMakeDoubleVarInRange+0xcc>
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     121f <cgiMakeDoubleVarInRange+0xff>
mov    -0x18(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiMakeDoubleVarInRange>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r12
test   %edx,%edx
jne    1164 <cgiMakeDoubleVarInRange+0x34>
test   %r15,%r15
je     1164 <cgiMakeDoubleVarInRange+0x34>
mov    %r15,%rdi
movsd  %xmm0,(%rsp)
call   1040 <strlen@plt>
movsd  (%rsp),%xmm0
add    %eax,%eax
lea    (%rax,%rax,4),%edx
cmp    $0x42,%edx
mov    $0x41,%eax
cmovge %edx,%eax
lea    0xe8a(%rip),%rdi
mov    %r12,%rsi
mov    %eax,%edx
mov    $0x1,%al
call   1050 <printf@plt>
test   %rbx,%rbx
lea    0xeeb(%rip),%rdx
cmove  %rdx,%rbx
test   %r15,%r15
cmovne %r15,%rdx
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14,%r14
je     11be <cgiMakeDoubleVarInRange+0x8e>
lea    0xeca(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec5(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [73 x i8] c"<INPUT TYPE=TEXT class='inputBox' name=\22%s\22 style='width: %dpx' value=%g\00"
@.str.1 = [46 x i8] c" onChange='return validateFloat(this,%s,%s);'\00"
@.str.2 = [7 x i8] c"\22null\22\00"
@.str.3 = [12 x i8] c" title='%s'\00"
@.str.4 = [3 x i8] c">\0A\00"
define void @cgiMakeDoubleVarInRange(i8* %0, double %1, i8* %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca double
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store double %1, double* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i32, i32* %10
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %6
%16 = load i8*, i8** %12
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i8*, i8** %12
%20 = call i32 @strlen(i8* %19)
%21 = mul nsw i32 %20, 10
store i32 %21, i32* %10
br label %22
22: ; preds = %18, %15
br label %23
23: ; preds = %22, %6
%24 = load i32, i32* %10
%25 = icmp slt i32 %24, 65
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 65, i32* %10
br label %27
27: ; preds = %26, %23
%28 = load i8*, i8** %7
%29 = load i32, i32* %10
%30 = load double, double* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i8* %28, i32 %29, double %30)
%32 = load i8*, i8** %11
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %36
34: ; preds = %27
%35 = load i8*, i8** %11
br label %37
36: ; preds = %27
br label %37
37: ; preds = %36, %34
%38 = phi i8* [ %35, %34 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %36 ]
%39 = load i8*, i8** %12
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = load i8*, i8** %12
br label %44
43: ; preds = %37
br label %44
44: ; preds = %43, %41
%45 = phi i8* [ %42, %41 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %43 ]
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %38, i8* %45)
%47 = load i8*, i8** %9
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = load i8*, i8** %9
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %49, %44
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [73 x i8] c"<INPUT TYPE=TEXT class='inputBox' name=\22%s\22 style='width: %dpx' value=%g\00"
@.str.1 = [46 x i8] c" onChange='return validateFloat(this,%s,%s);'\00"
@.str.2 = [7 x i8] c"\22null\22\00"
@.str.3 = [12 x i8] c" title='%s'\00"
@str = [2 x i8] c">\00"
define void @cgiMakeDoubleVarInRange(i8* %0, double %1, i8* %2, i32 %3, i8* %4, i8* %5) {
%7 = icmp eq i32 %3, 0
%8 = icmp ne i8* %5, null
%9 = and i1 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = tail call i32 @strlen(i8* %5)
%12 = mul nsw i32 %11, 10
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ %12, %10 ], [ %3, %6 ]
%15 = icmp sgt i32 %14, 65
%16 = select i1 %15, i32 %14, i32 65
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %16, double %1)
%18 = icmp eq i8* %4, null
%19 = select i1 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %4
%20 = select i1 %8, i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %20)
%22 = icmp eq i8* %2, null
br i1 %22, label %25, label %23
23: ; preds = %13
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %2)
br label %25
25: ; preds = %23, %13
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}