#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*/ snprintf(char *, int, char *, char *, ...);
void generate_qualifier(char *d, int dsize, char *attr, int min, int max,
                        int hardmax) {
  if (min > 0)
    snprintf(d, dsize, " %s \"%s\" %d", attr,
             (min == max) ? "EQUAL TO" : "AT LEAST", min);
  else if (max < hardmax)
    snprintf(d, dsize, " %s \"AT BEST\" %d", attr, max);
}


x86 assembly (clang, -O0):
<generate_qualifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1176 <generate_qualifier+0x66>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%r9d
lea    0xec4(%rip),%r8
lea    0xeb4(%rip),%rax
cmp    %r9d,%edx
cmove  %rax,%r8
mov    -0x1c(%rbp),%r9d
lea    0xe96(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    11a4 <generate_qualifier+0x94>
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    119f <generate_qualifier+0x8f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8d
lea    0xe86(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    11a4 <generate_qualifier+0x94>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_qualifier>:
mov    %ecx,%eax
mov    %rdx,%rcx
test   %eax,%eax
jle    113f <generate_qualifier+0x2f>
cmp    %r8d,%eax
lea    0xee9(%rip),%rdx
lea    0xeeb(%rip),%r8
cmove  %rdx,%r8
lea    0xecb(%rip),%rdx
mov    %eax,%r9d
xor    %eax,%eax
jmp    1030 <snprintf@plt>
cmp    %r9d,%r8d
jge    1152 <generate_qualifier+0x42>
lea    0xed3(%rip),%rdx
xor    %eax,%eax
jmp    1030 <snprintf@plt>
ret

LLVM IR (-O0):
@.str = [12 x i8] c" %s \22%s\22 %d\00"
@.str.1 = [9 x i8] c"EQUAL TO\00"
@.str.2 = [9 x i8] c"AT LEAST\00"
@.str.3 = [17 x i8] c" %s \22AT BEST\22 %d\00"
define void @generate_qualifier(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %10
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %26
15: ; preds = %6
%16 = load i8*, i8** %7
%17 = load i32, i32* %8
%18 = load i8*, i8** %9
%19 = load i32, i32* %10
%20 = load i32, i32* %11
%21 = icmp eq i32 %19, %20
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0)
%24 = load i32, i32* %10
%25 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %16, i32 %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %23, i32 %24)
br label %37
26: ; preds = %6
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load i8*, i8** %7
%32 = load i32, i32* %8
%33 = load i8*, i8** %9
%34 = load i32, i32* %11
%35 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %31, i32 %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %33, i32 %34)
br label %36
36: ; preds = %30, %26
br label %37
37: ; preds = %36, %15
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c" %s \22%s\22 %d\00"
@.str.1 = [9 x i8] c"EQUAL TO\00"
@.str.2 = [9 x i8] c"AT LEAST\00"
@.str.3 = [17 x i8] c" %s \22AT BEST\22 %d\00"
define void @generate_qualifier(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = icmp eq i32 %3, %4
%10 = select i1 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0)
%11 = tail call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %10, i32 %3)
br label %16
12: ; preds = %6
%13 = icmp slt i32 %4, %5
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = tail call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %2, i32 %4)
br label %16
16: ; preds = %12, %14, %8
ret void
}