#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 */
scalar_t__ strcmp(char *, char *);
int is_a_register(char *str) {
  char *registers[6] = {"r0", "r1", "r2", "r3", "r4", "r5"};
  for (int x = 0; x < 6; x++) {
    if (strcmp(registers[x], str) == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_a_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
lea    0xebd(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xea5(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe9d(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe95(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x6,-0x44(%rbp)
jge    11ca <is_a_register+0xaa>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b7 <is_a_register+0x97>
movl   $0x1,-0x4(%rbp)
jmp    11d1 <is_a_register+0xb1>
jmp    11bc <is_a_register+0x9c>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1185 <is_a_register+0x65>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_a_register>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1197 <is_a_register+0x87>
lea    0xecd(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1197 <is_a_register+0x87>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1197 <is_a_register+0x87>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1197 <is_a_register+0x87>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1197 <is_a_register+0x87>
lea    0xe89(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"r0\00"
@.str.1 = [3 x i8] c"r1\00"
@.str.2 = [3 x i8] c"r2\00"
@.str.3 = [3 x i8] c"r3\00"
@.str.4 = [3 x i8] c"r4\00"
@.str.5 = [3 x i8] c"r5\00"
define i32 @is_a_register(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [6 x i8*]
%5 = alloca i32
store i8* %0, i8** %3
%6 = bitcast [6 x i8*]* %4 to i8*
%7 = bitcast i8* %6 to [6 x i8*]*
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %7, i32 0, i32 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %7, i32 0, i32 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %7, i32 0, i32 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %7, i32 0, i32 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %7, i32 0, i32 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [6 x i8*], [6 x i8*]* %7, i32 0, i32 5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8** %13
store i32 0, i32* %5
br label %14
14: ; preds = %27, %1
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 6
br i1 %16, label %17, label %30
17: ; preds = %14
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i64 0, i64 %19
%21 = load i8*, i8** %20
%22 = load i8*, i8** %3
%23 = call i64 @strcmp(i8* %21, i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %17
store i32 1, i32* %2
br label %31
26: ; preds = %17
br label %27
27: ; preds = %26
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %14
30: ; preds = %14
store i32 0, i32* %2
br label %31
31: ; preds = %30, %25
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"r0\00"
@.str.1 = [3 x i8] c"r1\00"
@.str.2 = [3 x i8] c"r2\00"
@.str.3 = [3 x i8] c"r3\00"
@.str.4 = [3 x i8] c"r4\00"
@.str.5 = [3 x i8] c"r5\00"
define i32 @is_a_register(i8* %0) {
%2 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %20, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%12 = icmp eq i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %10
%14 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%15 = icmp eq i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %13
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %16, %13, %10, %7, %4, %1
%21 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 1, %7 ], [ 1, %10 ], [ 1, %13 ], [ %19, %16 ]
ret i32 %21
}