#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 */
char *get_full_attribute_name(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, ...);
scalar_t__ timlib_strcmp(char *, char *);
char *query_get_drop_down_data_where(char *application_name, char *folder_name,
                                     char *attribute_name, char *data) {
  static char where[1024];
  *where = '\0';
  if (folder_name) {
    if (timlib_strcmp(data, "is_empty") == 0) {
      sprintf(where, " (%s = 'null' or %s = '' or %s is null)",
              get_full_attribute_name(application_name, folder_name,
                                      attribute_name),
              get_full_attribute_name(application_name, folder_name,
                                      attribute_name),
              get_full_attribute_name(application_name, folder_name,
                                      attribute_name));
    } else if (timlib_strcmp(data, "not_empty") == 0) {
      sprintf(where, " (%s <> 'null' or %s <> '' or %s is not null)",
              get_full_attribute_name(application_name, folder_name,
                                      attribute_name),
              get_full_attribute_name(application_name, folder_name,
                                      attribute_name),
              get_full_attribute_name(application_name, folder_name,
                                      attribute_name));
    } else {
      sprintf(where, " %s = '%s'",
              get_full_attribute_name(application_name, folder_name,
                                      attribute_name),
              data);
    }
  } else {
    if (timlib_strcmp(data, "is_empty") == 0) {
      sprintf(where, " (%s = 'null' or %s = '' or %s is null)", attribute_name,
              attribute_name, attribute_name);
    } else if (timlib_strcmp(data, "not_empty") == 0) {
      sprintf(where, " (%s <> 'null' or %s <> '' or %s is not null)",
              attribute_name, attribute_name, attribute_name);
    } else {
      sprintf(where, " %s = '%s'", attribute_name, data);
    }
  }
  return where;
}


x86 assembly (clang, -O0):
<query_get_drop_down_data_where>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movb   $0x0,0x2f01(%rip)
cmpq   $0x0,-0x10(%rbp)
je     1285 <query_get_drop_down_data_where+0x155>
mov    -0x20(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1050 <timlib_strcmp@plt>
cmp    $0x0,%rax
jne    11d4 <query_get_drop_down_data_where+0xa4>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_full_attribute_name@plt>
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rax,%r8
lea    0x2e8f(%rip),%rdi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1280 <query_get_drop_down_data_where+0x150>
mov    -0x20(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1050 <timlib_strcmp@plt>
cmp    $0x0,%rax
jne    124e <query_get_drop_down_data_where+0x11e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_full_attribute_name@plt>
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    %rax,%r8
lea    0x2e15(%rip),%rdi
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    127b <query_get_drop_down_data_where+0x14b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rcx
lea    0x2de3(%rip),%rdi
lea    0xdf5(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1280 <query_get_drop_down_data_where+0x150>
jmp    132c <query_get_drop_down_data_where+0x1fc>
mov    -0x20(%rbp),%rdi
lea    0xd70(%rip),%rsi
call   1050 <timlib_strcmp@plt>
cmp    $0x0,%rax
jne    12c5 <query_get_drop_down_data_where+0x195>
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0x2d9e(%rip),%rdi
lea    0xd50(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1327 <query_get_drop_down_data_where+0x1f7>
mov    -0x20(%rbp),%rdi
lea    0xd61(%rip),%rsi
call   1050 <timlib_strcmp@plt>
cmp    $0x0,%rax
jne    1305 <query_get_drop_down_data_where+0x1d5>
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0x2d5e(%rip),%rdi
lea    0xd42(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1322 <query_get_drop_down_data_where+0x1f2>
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0x2d3c(%rip),%rdi
lea    0xd4e(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1327 <query_get_drop_down_data_where+0x1f7>
jmp    132c <query_get_drop_down_data_where+0x1fc>
lea    0x2d1d(%rip),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<query_get_drop_down_data_where>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r12
movb   $0x0,0x2f02(%rip)
lea    0xeab(%rip),%rsi
mov    %rcx,%rdi
call   1050 <timlib_strcmp@plt>
test   %rbx,%rbx
je     11aa <query_get_drop_down_data_where+0x7a>
test   %rax,%rax
je     11eb <query_get_drop_down_data_where+0xbb>
lea    0xebf(%rip),%rsi
mov    %r15,%rdi
call   1050 <timlib_strcmp@plt>
mov    %rax,%rbp
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,%r13
test   %rbp,%rbp
je     1231 <query_get_drop_down_data_where+0x101>
lea    0x2eb2(%rip),%rdi
lea    0xec4(%rip),%rsi
mov    %r13,%rdx
jmp    11dc <query_get_drop_down_data_where+0xac>
test   %rax,%rax
je     1269 <query_get_drop_down_data_where+0x139>
lea    0xe77(%rip),%rsi
mov    %r15,%rdi
call   1050 <timlib_strcmp@plt>
lea    0x2e87(%rip),%rdi
test   %rax,%rax
je     1279 <query_get_drop_down_data_where+0x149>
lea    0xe90(%rip),%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1290 <query_get_drop_down_data_where+0x160>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,%r15
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,%r13
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <get_full_attribute_name@plt>
lea    0x2e2e(%rip),%rdi
lea    0xde0(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%rcx
jmp    1264 <query_get_drop_down_data_where+0x134>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <get_full_attribute_name@plt>
mov    %rax,%rbp
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <get_full_attribute_name@plt>
lea    0x2df9(%rip),%rdi
lea    0xddd(%rip),%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
jmp    1289 <query_get_drop_down_data_where+0x159>
lea    0x2de0(%rip),%rdi
lea    0xd92(%rip),%rsi
jmp    1280 <query_get_drop_down_data_where+0x150>
lea    0xdbb(%rip),%rsi
mov    %r14,%rdx
mov    %r14,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0x2db9(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@query_get_drop_down_data_where.where = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c"is_empty\00"
@.str.1 = [40 x i8] c" (%s = 'null' or %s = '' or %s is null)\00"
@.str.2 = [10 x i8] c"not_empty\00"
@.str.3 = [46 x i8] c" (%s <> 'null' or %s <> '' or %s is not null)\00"
@.str.4 = [11 x i8] c" %s = '%s'\00"
define i8* @query_get_drop_down_data_where(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0)
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %56
11: ; preds = %4
%12 = load i8*, i8** %8
%13 = call i64 @timlib_strcmp(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = load i8*, i8** %7
%19 = call i8* @get_full_attribute_name(i8* %16, i8* %17, i8* %18)
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = call i8* @get_full_attribute_name(i8* %20, i8* %21, i8* %22)
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = load i8*, i8** %7
%27 = call i8* @get_full_attribute_name(i8* %24, i8* %25, i8* %26)
%28 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %23, i8* %27)
br label %55
29: ; preds = %11
%30 = load i8*, i8** %8
%31 = call i64 @timlib_strcmp(i8* %30, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %47
33: ; preds = %29
%34 = load i8*, i8** %5
%35 = load i8*, i8** %6
%36 = load i8*, i8** %7
%37 = call i8* @get_full_attribute_name(i8* %34, i8* %35, i8* %36)
%38 = load i8*, i8** %5
%39 = load i8*, i8** %6
%40 = load i8*, i8** %7
%41 = call i8* @get_full_attribute_name(i8* %38, i8* %39, i8* %40)
%42 = load i8*, i8** %5
%43 = load i8*, i8** %6
%44 = load i8*, i8** %7
%45 = call i8* @get_full_attribute_name(i8* %42, i8* %43, i8* %44)
%46 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %37, i8* %41, i8* %45)
br label %54
47: ; preds = %29
%48 = load i8*, i8** %5
%49 = load i8*, i8** %6
%50 = load i8*, i8** %7
%51 = call i8* @get_full_attribute_name(i8* %48, i8* %49, i8* %50)
%52 = load i8*, i8** %8
%53 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %51, i8* %52)
br label %54
54: ; preds = %47, %33
br label %55
55: ; preds = %54, %15
br label %80
56: ; preds = %4
%57 = load i8*, i8** %8
%58 = call i64 @timlib_strcmp(i8* %57, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %56
%61 = load i8*, i8** %7
%62 = load i8*, i8** %7
%63 = load i8*, i8** %7
%64 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %61, i8* %62, i8* %63)
br label %79
65: ; preds = %56
%66 = load i8*, i8** %8
%67 = call i64 @timlib_strcmp(i8* %66, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %74
69: ; preds = %65
%70 = load i8*, i8** %7
%71 = load i8*, i8** %7
%72 = load i8*, i8** %7
%73 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %70, i8* %71, i8* %72)
br label %78
74: ; preds = %65
%75 = load i8*, i8** %7
%76 = load i8*, i8** %8
%77 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %75, i8* %76)
br label %78
78: ; preds = %74, %69
br label %79
79: ; preds = %78, %60
br label %80
80: ; preds = %79, %55
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0)
}

LLVM IR (-O2):
@query_get_drop_down_data_where.where = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c"is_empty\00"
@.str.1 = [40 x i8] c" (%s = 'null' or %s = '' or %s is null)\00"
@.str.2 = [10 x i8] c"not_empty\00"
@.str.3 = [46 x i8] c" (%s <> 'null' or %s <> '' or %s is not null)\00"
@.str.4 = [11 x i8] c" %s = '%s'\00"
define i8* @query_get_drop_down_data_where(i8* %0, i8* %1, i8* %2, i8* %3) {
store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0)
%5 = icmp eq i8* %1, null
%6 = tail call i64 @timlib_strcmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %5, label %24, label %8
8: ; preds = %4
br i1 %7, label %9, label %14
9: ; preds = %8
%10 = tail call i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2)
%11 = tail call i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2)
%12 = tail call i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2)
%13 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %11, i8* %12)
br label %34
14: ; preds = %8
%15 = tail call i64 @timlib_strcmp(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
%17 = tail call i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2)
br i1 %16, label %18, label %22
18: ; preds = %14
%19 = tail call i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2)
%20 = tail call i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2)
%21 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %17, i8* %19, i8* %20)
br label %34
22: ; preds = %14
%23 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %17, i8* %3)
br label %34
24: ; preds = %4
br i1 %7, label %25, label %27
25: ; preds = %24
%26 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %2, i8* %2)
br label %34
27: ; preds = %24
%28 = tail call i64 @timlib_strcmp(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* %2, i8* %2)
br label %34
32: ; preds = %27
%33 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* %3)
br label %34
34: ; preds = %25, %32, %30, %9, %22, %18
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @query_get_drop_down_data_where.where, i64 0, i64 0)
}