#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 tolower(char);
void BelongsAt(char *psName, int *x, int *y, int *z) {
  int i;
  *x = *y = *z = 1;
  for (i = 0; i < 3; i++) {
    switch (tolower(psName[i])) {
    case 'r':
      *x = 0;
      break;
    case 'o':
      *x = 2;
      break;
    case 'y':
      *y = 0;
      break;
    case 'w':
      *y = 2;
      break;
    case 'g':
      *z = 0;
      break;
    case 'b':
      *z = 2;
      break;
    }
  }
}


x86 assembly (clang, -O0):
<BelongsAt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    11f6 <BelongsAt+0xe6>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x17,%eax
ja     11e3 <BelongsAt+0xd3>
mov    -0x30(%rbp),%rax
lea    0xe7b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11e3 <BelongsAt+0xd3>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    11e3 <BelongsAt+0xd3>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    11e3 <BelongsAt+0xd3>
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
jmp    11e3 <BelongsAt+0xd3>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    11e3 <BelongsAt+0xd3>
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
jmp    11e8 <BelongsAt+0xd8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <BelongsAt+0x3d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BelongsAt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
movl   $0x1,(%rcx)
movl   $0x1,(%rdx)
movl   $0x1,(%rsi)
movsbl (%rdi),%edi
call   1030 <tolower@plt>
add    $0xffffff9e,%eax
cmp    $0x17,%eax
ja     118c <BelongsAt+0x7c>
lea    0xeb3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,(%r14)
jmp    118c <BelongsAt+0x7c>
movl   $0x0,(%r14)
jmp    118c <BelongsAt+0x7c>
movl   $0x2,(%r12)
jmp    118c <BelongsAt+0x7c>
movl   $0x0,(%r12)
jmp    118c <BelongsAt+0x7c>
movl   $0x2,(%r15)
jmp    118c <BelongsAt+0x7c>
movl   $0x0,(%r15)
movsbl 0x1(%rbx),%edi
call   1030 <tolower@plt>
add    $0xffffff9e,%eax
cmp    $0x17,%eax
ja     11e3 <BelongsAt+0xd3>
lea    0xebc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,(%r14)
jmp    11e3 <BelongsAt+0xd3>
movl   $0x0,(%r14)
jmp    11e3 <BelongsAt+0xd3>
movl   $0x2,(%r12)
jmp    11e3 <BelongsAt+0xd3>
movl   $0x0,(%r12)
jmp    11e3 <BelongsAt+0xd3>
movl   $0x2,(%r15)
jmp    11e3 <BelongsAt+0xd3>
movl   $0x0,(%r15)
movsbl 0x2(%rbx),%edi
call   1030 <tolower@plt>
add    $0xffffff9e,%eax
cmp    $0x17,%eax
ja     123a <BelongsAt+0x12a>
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,(%r14)
jmp    123a <BelongsAt+0x12a>
movl   $0x0,(%r14)
jmp    123a <BelongsAt+0x12a>
movl   $0x2,(%r12)
jmp    123a <BelongsAt+0x12a>
movl   $0x0,(%r12)
jmp    123a <BelongsAt+0x12a>
movl   $0x2,(%r15)
jmp    123a <BelongsAt+0x12a>
movl   $0x0,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @BelongsAt(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %8
store i32 1, i32* %10
%11 = load i32*, i32** %7
store i32 1, i32* %11
%12 = load i32*, i32** %6
store i32 1, i32* %12
store i32 0, i32* %9
br label %13
13: ; preds = %36, %4
%14 = load i32, i32* %9
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %39
16: ; preds = %13
%17 = load i8*, i8** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @tolower(i8 signext %21)
switch i32 %22, label %35 [
i32 114, label %23
i32 111, label %25
i32 121, label %27
i32 119, label %29
i32 103, label %31
i32 98, label %33
]
23: ; preds = %16
%24 = load i32*, i32** %6
store i32 0, i32* %24
br label %35
25: ; preds = %16
%26 = load i32*, i32** %6
store i32 2, i32* %26
br label %35
27: ; preds = %16
%28 = load i32*, i32** %7
store i32 0, i32* %28
br label %35
29: ; preds = %16
%30 = load i32*, i32** %7
store i32 2, i32* %30
br label %35
31: ; preds = %16
%32 = load i32*, i32** %8
store i32 0, i32* %32
br label %35
33: ; preds = %16
%34 = load i32*, i32** %8
store i32 2, i32* %34
br label %35
35: ; preds = %16, %33, %31, %29, %27, %25, %23
br label %36
36: ; preds = %35
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
br label %13
39: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @BelongsAt(i8* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
store i32 1, i32* %3
store i32 1, i32* %2
store i32 1, i32* %1
%5 = load i8, i8* %0
%6 = tail call i32 @tolower(i8 signext %5)
switch i32 %6, label %13 [
i32 114, label %7
i32 111, label %8
i32 121, label %9
i32 119, label %10
i32 103, label %11
i32 98, label %12
]
7: ; preds = %4
store i32 0, i32* %1
br label %13
8: ; preds = %4
store i32 2, i32* %1
br label %13
9: ; preds = %4
store i32 0, i32* %2
br label %13
10: ; preds = %4
store i32 2, i32* %2
br label %13
11: ; preds = %4
store i32 0, i32* %3
br label %13
12: ; preds = %4
store i32 2, i32* %3
br label %13
13: ; preds = %7, %8, %9, %10, %11, %12, %4
%14 = getelementptr inbounds i8, i8* %0, i64 1
%15 = load i8, i8* %14
%16 = tail call i32 @tolower(i8 signext %15)
switch i32 %16, label %23 [
i32 114, label %22
i32 111, label %21
i32 121, label %20
i32 119, label %19
i32 103, label %18
i32 98, label %17
]
17: ; preds = %13
store i32 2, i32* %3
br label %23
18: ; preds = %13
store i32 0, i32* %3
br label %23
19: ; preds = %13
store i32 2, i32* %2
br label %23
20: ; preds = %13
store i32 0, i32* %2
br label %23
21: ; preds = %13
store i32 2, i32* %1
br label %23
22: ; preds = %13
store i32 0, i32* %1
br label %23
23: ; preds = %22, %21, %20, %19, %18, %17, %13
%24 = getelementptr inbounds i8, i8* %0, i64 2
%25 = load i8, i8* %24
%26 = tail call i32 @tolower(i8 signext %25)
switch i32 %26, label %33 [
i32 114, label %32
i32 111, label %31
i32 121, label %30
i32 119, label %29
i32 103, label %28
i32 98, label %27
]
27: ; preds = %23
store i32 2, i32* %3
br label %33
28: ; preds = %23
store i32 0, i32* %3
br label %33
29: ; preds = %23
store i32 2, i32* %2
br label %33
30: ; preds = %23
store i32 0, i32* %2
br label %33
31: ; preds = %23
store i32 2, i32* %1
br label %33
32: ; preds = %23
store i32 0, i32* %1
br label %33
33: ; preds = %32, %31, %30, %29, %28, %27, %23
ret void
}