#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 */
size_t edit_xscript_to_rflen(const char *edit_xscript) {
  const char *cur = edit_xscript;
  size_t rflen = 0;
  while (*cur != '\0') {
    if (*cur == 'S' || *cur == '=' || *cur == 'X' || *cur == 'D') {
      rflen++;
    }
    cur++;
  }
  return rflen;
}


x86 assembly (clang, -O0):
<edit_xscript_to_rflen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1185 <edit_xscript_to_rflen+0x85>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x53,%eax
je     1168 <edit_xscript_to_rflen+0x68>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     1168 <edit_xscript_to_rflen+0x68>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
je     1168 <edit_xscript_to_rflen+0x68>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x44,%eax
jne    1174 <edit_xscript_to_rflen+0x74>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <edit_xscript_to_rflen+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<edit_xscript_to_rflen>:
xor    %eax,%eax
mov    $0x8400081,%ecx
jmp    1124 <edit_xscript_to_rflen+0x24>
nopl   0x0(%rax)
test   %dl,%dl
je     1140 <edit_xscript_to_rflen+0x40>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rdi
movzbl (%rdi),%edx
lea    -0x3d(%rdx),%esi
cmp    $0x1b,%sil
ja     1110 <edit_xscript_to_rflen+0x10>
movzbl %sil,%esi
bt     %rsi,%rcx
jae    1110 <edit_xscript_to_rflen+0x10>
add    $0x1,%rax
jmp    1120 <edit_xscript_to_rflen+0x20>
ret

LLVM IR (-O0):
define i64 @edit_xscript_to_rflen(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
store i64 0, i64* %4
br label %6
6: ; preds = %34, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %37
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 83
br i1 %15, label %31, label %16
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 61
br i1 %20, label %31, label %21
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 88
br i1 %25, label %31, label %26
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 68
br i1 %30, label %31, label %34
31: ; preds = %26, %21, %16, %11
%32 = load i64, i64* %4
%33 = add i64 %32, 1
store i64 %33, i64* %4
br label %34
34: ; preds = %31, %26
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %3
br label %6
37: ; preds = %6
%38 = load i64, i64* %4
ret i64 %38
}

LLVM IR (-O2):
define i64 @edit_xscript_to_rflen(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i64 [ 0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 83, label %6
i8 61, label %6
i8 88, label %6
i8 68, label %6
]
6: ; preds = %2, %2, %2, %2
%7 = add i64 %4, 1
br label %8
8: ; preds = %2, %6
%9 = phi i64 [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i64 %4
}