#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*/ Qt_handleString(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strstr(char *, char *);
int Qt_setColorMode(char *widget, char *token) {
  char asc[80];
  char aux[80];
  if (strstr(widget, "Gauge") != (char *)0)
    return 0;
  if (!strcmp(token, "static")) {
    sprintf(asc, "%s::Static", widget);
    Qt_handleString("colorMode", "enum", asc);
    return 0;
  } else if (!strcmp(token, "alarm")) {
    strcpy(aux, "Alarm");
    if (!strcmp(widget, "caTextEntry"))
      strcpy(aux, "Alarm_Static");
    if (!strcmp(widget, "caLineEdit"))
      strcpy(aux, "Alarm_Static");
    sprintf(asc, "%s::%s", widget, aux);
    Qt_handleString("colorMode", "enum", asc);
    return 1;
  } else if (!strcmp(token, "discrete")) {
    sprintf(asc, "%s::Static", widget);
    Qt_handleString("colorMode", "enum", asc);
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Qt_setColorMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     1189 <Qt_setColorMode+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1302 <Qt_setColorMode+0x1b2>
mov    -0x18(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11db <Qt_setColorMode+0x8b>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x70(%rbp),%rdx
lea    0xe55(%rip),%rdi
lea    0xe58(%rip),%rsi
call   1040 <Qt_handleString@plt>
movl   $0x0,-0x4(%rbp)
jmp    1302 <Qt_setColorMode+0x1b2>
mov    -0x18(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    129f <Qt_setColorMode+0x14f>
lea    -0xc0(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1233 <Qt_setColorMode+0xe3>
lea    -0xc0(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    125f <Qt_setColorMode+0x10f>
lea    -0xc0(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    0xde2(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x70(%rbp),%rdx
lea    0xd91(%rip),%rdi
lea    0xd94(%rip),%rsi
call   1040 <Qt_handleString@plt>
movl   $0x1,-0x4(%rbp)
jmp    1302 <Qt_setColorMode+0x1b2>
mov    -0x18(%rbp),%rdi
lea    0xdb4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12f1 <Qt_setColorMode+0x1a1>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd46(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x70(%rbp),%rdx
lea    0xd3f(%rip),%rdi
lea    0xd42(%rip),%rsi
call   1040 <Qt_handleString@plt>
movl   $0x0,-0x4(%rbp)
jmp    1302 <Qt_setColorMode+0x1b2>
jmp    12f6 <Qt_setColorMode+0x1a6>
jmp    12fb <Qt_setColorMode+0x1ab>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Qt_setColorMode>:
push   %rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe98(%rip),%rsi
call   1070 <strstr@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    1258 <Qt_setColorMode+0x108>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11b5 <Qt_setColorMode+0x65>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11cf <Qt_setColorMode+0x7f>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    1258 <Qt_setColorMode+0x108>
lea    0xe51(%rip),%rsi
xor    %ebp,%ebp
lea    0x50(%rsp),%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <sprintf@plt>
jmp    1240 <Qt_setColorMode+0xf0>
lea    0xe57(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
lea    0xe4e(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    1200 <Qt_setColorMode+0xb0>
lea    0xe47(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
lea    0xe45(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    1222 <Qt_setColorMode+0xd2>
lea    0xe25(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
lea    0xe2e(%rip),%rsi
lea    0x50(%rsp),%rdi
mov    %rsp,%rcx
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    $0x1,%ebp
lea    0xdd1(%rip),%rdi
lea    0xdd4(%rip),%rsi
lea    0x50(%rsp),%rdx
call   1040 <Qt_handleString@plt>
mov    %ebp,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Gauge\00"
@.str.1 = [7 x i8] c"static\00"
@.str.2 = [11 x i8] c"%s::Static\00"
@.str.3 = [10 x i8] c"colorMode\00"
@.str.4 = [5 x i8] c"enum\00"
@.str.5 = [6 x i8] c"alarm\00"
@.str.6 = [6 x i8] c"Alarm\00"
@.str.7 = [12 x i8] c"caTextEntry\00"
@.str.8 = [13 x i8] c"Alarm_Static\00"
@.str.9 = [11 x i8] c"caLineEdit\00"
@.str.10 = [7 x i8] c"%s::%s\00"
@.str.11 = [9 x i8] c"discrete\00"
define i32 @Qt_setColorMode(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i8* @strstr(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %62
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %12
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%18 = load i8*, i8** %4
%19 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%21 = call i32 @Qt_handleString(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %20)
store i32 0, i32* %3
br label %62
22: ; preds = %12
%23 = load i8*, i8** %5
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %49, label %26
26: ; preds = %22
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%28 = call i32 @strcpy(i8* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%29 = load i8*, i8** %4
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %26
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%34 = call i32 @strcpy(i8* %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %35
35: ; preds = %32, %26
%36 = load i8*, i8** %4
%37 = call i32 @strcmp(i8* %36, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %35
%40 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%41 = call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %42
42: ; preds = %39, %35
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%44 = load i8*, i8** %4
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%46 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %43, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* %44, i8* %45)
%47 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%48 = call i32 @Qt_handleString(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %47)
store i32 1, i32* %3
br label %62
49: ; preds = %22
%50 = load i8*, i8** %5
%51 = call i32 @strcmp(i8* %50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%52 = icmp ne i32 %51, 0
br i1 %52, label %59, label %53
53: ; preds = %49
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%55 = load i8*, i8** %4
%56 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %54, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %55)
%57 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%58 = call i32 @Qt_handleString(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %57)
store i32 0, i32* %3
br label %62
59: ; preds = %49
br label %60
60: ; preds = %59
br label %61
61: ; preds = %60
store i32 0, i32* %3
br label %62
62: ; preds = %61, %53, %42, %16, %11
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
@.str = [6 x i8] c"Gauge\00"
@.str.1 = [7 x i8] c"static\00"
@.str.2 = [11 x i8] c"%s::Static\00"
@.str.3 = [10 x i8] c"colorMode\00"
@.str.4 = [5 x i8] c"enum\00"
@.str.5 = [6 x i8] c"alarm\00"
@.str.6 = [6 x i8] c"Alarm\00"
@.str.7 = [12 x i8] c"caTextEntry\00"
@.str.8 = [13 x i8] c"Alarm_Static\00"
@.str.9 = [11 x i8] c"caLineEdit\00"
@.str.10 = [7 x i8] c"%s::%s\00"
@.str.11 = [9 x i8] c"discrete\00"
define i32 @Qt_setColorMode(i8* %0, i8* nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%7 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %38
9: ; preds = %2
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %35
14: ; preds = %9
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %30
17: ; preds = %14
%18 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %23
23: ; preds = %21, %17
%24 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* %0, i8* %6)
br label %35
30: ; preds = %14
%31 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %35
35: ; preds = %12, %28, %33
%36 = phi i32 [ 0, %12 ], [ 1, %28 ], [ 0, %33 ]
%37 = call i32 @Qt_handleString(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %5)
br label %38
38: ; preds = %35, %30, %2
%39 = phi i32 [ 0, %2 ], [ 0, %30 ], [ %36, %35 ]
ret i32 %39
}