#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__ strchr(char *, char const);
int is_arm_mapping_symbol(const char *str) {
  return str[0] == '$' && strchr("atd", str[1]) &&
         (str[2] == '\0' || str[2] == '.');
}


x86 assembly (clang, -O0):
<is_arm_mapping_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x24,%ecx
mov    %al,-0x9(%rbp)
jne    1184 <is_arm_mapping_symbol+0x74>
mov    -0x8(%rbp),%rax
lea    0xec4(%rip),%rdi
movsbl 0x1(%rax),%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1184 <is_arm_mapping_symbol+0x74>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     117e <is_arm_mapping_symbol+0x6e>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2e,%eax
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_arm_mapping_symbol>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
cmpb   $0x24,(%rdi)
jne    1148 <is_arm_mapping_symbol+0x38>
mov    %rdi,%rbx
movsbl 0x1(%rdi),%esi
lea    0xed8(%rip),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1148 <is_arm_mapping_symbol+0x38>
mov    0x2(%rbx),%al
test   %al,%al
je     1143 <is_arm_mapping_symbol+0x33>
xor    %ebp,%ebp
cmp    $0x2e,%al
sete   %bpl
jmp    1148 <is_arm_mapping_symbol+0x38>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"atd\00"
define i32 @is_arm_mapping_symbol(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 36
br i1 %7, label %8, label %28
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = call i64 @strchr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %14
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 46
br label %26
26: ; preds = %20, %14
%27 = phi i1 [ true, %14 ], [ %25, %20 ]
br label %28
28: ; preds = %26, %8, %1
%29 = phi i1 [ false, %8 ], [ false, %1 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
@.str = [4 x i8] c"atd\00"
define i32 @is_arm_mapping_symbol(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 36
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i64 @strchr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %9
%14 = icmp eq i8 %11, 46
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %9, %13, %4, %1
%17 = phi i32 [ 0, %4 ], [ 0, %1 ], [ 1, %9 ], [ %15, %13 ]
ret i32 %17
}