#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 GLUT_ACTIVE_ALT;
int GLUT_ACTIVE_CTRL;
int GLUT_ACTIVE_SHIFT;
int /*<<< orphan*/ strcat(char *, char *);
void Mod2Text(int mods, char *text) {
  if (mods & GLUT_ACTIVE_CTRL)
    strcat(text, "CTRL");
  if (mods & GLUT_ACTIVE_SHIFT) {
    if (text[0])
      strcat(text, "+SHIFT");
    else
      strcat(text, "SHIFT");
  }
  if (mods & GLUT_ACTIVE_ALT) {
    if (text[0])
      strcat(text, "+ALT");
    else
      strcat(text, "ALT");
  }
  if (!text[0])
    strcat(text, "none");
}


x86 assembly (clang, -O0):
<Mod2Text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eaf(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1144 <Mod2Text+0x34>
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
mov    0x2e82(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1190 <Mod2Text+0x80>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     117b <Mod2Text+0x6b>
mov    -0x10(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1030 <strcat@plt>
jmp    118b <Mod2Text+0x7b>
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcat@plt>
jmp    1190 <Mod2Text+0x80>
mov    -0x4(%rbp),%eax
mov    0x2e5e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11dc <Mod2Text+0xcc>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c7 <Mod2Text+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <strcat@plt>
jmp    11d7 <Mod2Text+0xc7>
mov    -0x10(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1030 <strcat@plt>
jmp    11dc <Mod2Text+0xcc>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11f9 <Mod2Text+0xe9>
mov    -0x10(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1030 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mod2Text>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb9(%rip),%rax
test   %edi,(%rax)
je     1132 <Mod2Text+0x22>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
mov    0x2e97(%rip),%rax
test   %ebp,(%rax)
je     115a <Mod2Text+0x4a>
cmpb   $0x0,(%rbx)
lea    0xebf(%rip),%rax
lea    0xeb7(%rip),%rsi
cmove  %rax,%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
mov    0x2e97(%rip),%rax
test   %ebp,(%rax)
je     1182 <Mod2Text+0x72>
cmpb   $0x0,(%rbx)
lea    0xe9e(%rip),%rax
lea    0xe96(%rip),%rsi
cmove  %rax,%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
cmpb   $0x0,(%rbx)
je     118e <Mod2Text+0x7e>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <strcat@plt>

LLVM IR (-O0):
@GLUT_ACTIVE_CTRL = global i32 0
@.str = [5 x i8] c"CTRL\00"
@GLUT_ACTIVE_SHIFT = global i32 0
@.str.1 = [7 x i8] c"+SHIFT\00"
@.str.2 = [6 x i8] c"SHIFT\00"
@GLUT_ACTIVE_ALT = global i32 0
@.str.3 = [5 x i8] c"+ALT\00"
@.str.4 = [4 x i8] c"ALT\00"
@.str.5 = [5 x i8] c"none\00"
define void @Mod2Text(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @GLUT_ACTIVE_CTRL
%7 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %3
%14 = load i32, i32* @GLUT_ACTIVE_SHIFT
%15 = and i32 %13, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %29
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = icmp ne i8 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i8*, i8** %4
%24 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %28
25: ; preds = %17
%26 = load i8*, i8** %4
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %25, %22
br label %29
29: ; preds = %28, %12
%30 = load i32, i32* %3
%31 = load i32, i32* @GLUT_ACTIVE_ALT
%32 = and i32 %30, %31
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %46
34: ; preds = %29
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 0
%37 = load i8, i8* %36
%38 = icmp ne i8 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %34
%40 = load i8*, i8** %4
%41 = call i32 @strcat(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %45
42: ; preds = %34
%43 = load i8*, i8** %4
%44 = call i32 @strcat(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %42, %39
br label %46
46: ; preds = %45, %29
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = load i8, i8* %48
%50 = icmp ne i8 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %46
%52 = load i8*, i8** %4
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %51, %46
ret void
}

LLVM IR (-O2):
@GLUT_ACTIVE_CTRL = global i32 0
@.str = [5 x i8] c"CTRL\00"
@GLUT_ACTIVE_SHIFT = global i32 0
@.str.1 = [7 x i8] c"+SHIFT\00"
@.str.2 = [6 x i8] c"SHIFT\00"
@GLUT_ACTIVE_ALT = global i32 0
@.str.3 = [5 x i8] c"+ALT\00"
@.str.4 = [4 x i8] c"ALT\00"
@.str.5 = [5 x i8] c"none\00"
define void @Mod2Text(i32 %0, i8* %1) {
%3 = load i32, i32* @GLUT_ACTIVE_CTRL
%4 = and i32 %3, %0
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = load i32, i32* @GLUT_ACTIVE_SHIFT
%10 = and i32 %9, %0
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = load i8, i8* %1
%14 = icmp eq i8 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%16 = tail call i32 @strcat(i8* %1, i8* %15)
br label %17
17: ; preds = %12, %8
%18 = load i32, i32* @GLUT_ACTIVE_ALT
%19 = and i32 %18, %0
%20 = icmp eq i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %17
%22 = load i8, i8* %1
%23 = icmp eq i8 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%25 = tail call i32 @strcat(i8* %1, i8* %24)
br label %26
26: ; preds = %21, %17
%27 = load i8, i8* %1
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
ret void
}