#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 */
bool alg_can_come_before(char now, char before) {
  switch (now) {
  case 'I':
    return (before == 'X' || before == 'V');
    break;
  case 'X':
    return (before == 'C' || before == 'L');
    break;
  case 'C':
    return (before == 'D' || before == 'M');
    break;
  default:
    return false;
  }
}


x86 assembly (clang, -O0):
<alg_can_come_before>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x43,%eax
je     11a5 <alg_can_come_before+0xa5>
jmp    1125 <alg_can_come_before+0x25>
mov    -0xc(%rbp),%eax
sub    $0x49,%eax
je     1147 <alg_can_come_before+0x47>
jmp    1136 <alg_can_come_before+0x36>
mov    -0xc(%rbp),%eax
sub    $0x58,%eax
je     1176 <alg_can_come_before+0x76>
jmp    11d4 <alg_can_come_before+0xd4>
movsbl -0x6(%rbp),%ecx
mov    $0x1,%al
cmp    $0x58,%ecx
mov    %al,-0xd(%rbp)
je     1166 <alg_can_come_before+0x66>
movsbl -0x6(%rbp),%eax
cmp    $0x56,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11db <alg_can_come_before+0xdb>
movsbl -0x6(%rbp),%ecx
mov    $0x1,%al
cmp    $0x43,%ecx
mov    %al,-0xe(%rbp)
je     1195 <alg_can_come_before+0x95>
movsbl -0x6(%rbp),%eax
cmp    $0x4c,%eax
sete   %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11db <alg_can_come_before+0xdb>
movsbl -0x6(%rbp),%ecx
mov    $0x1,%al
cmp    $0x44,%ecx
mov    %al,-0xf(%rbp)
je     11c4 <alg_can_come_before+0xc4>
movsbl -0x6(%rbp),%eax
cmp    $0x4d,%eax
sete   %al
mov    %al,-0xf(%rbp)
mov    -0xf(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11db <alg_can_come_before+0xdb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<alg_can_come_before>:
cmp    $0x43,%edi
je     111e <alg_can_come_before+0x1e>
cmp    $0x58,%edi
je     112b <alg_can_come_before+0x2b>
cmp    $0x49,%edi
jne    113f <alg_can_come_before+0x3f>
add    $0xaa,%sil
test   $0xfd,%sil
sete   %al
movzbl %al,%eax
ret
cmp    $0x44,%sil
sete   %cl
cmp    $0x4d,%sil
jmp    1136 <alg_can_come_before+0x36>
cmp    $0x43,%sil
sete   %cl
cmp    $0x4c,%sil
sete   %al
or     %cl,%al
movzbl %al,%eax
ret
xor    %eax,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @alg_can_come_before(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
switch i32 %7, label %41 [
i32 73, label %8
i32 88, label %19
i32 67, label %30
]
8: ; preds = %2
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 88
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 86
br label %16
16: ; preds = %12, %8
%17 = phi i1 [ true, %8 ], [ %15, %12 ]
%18 = zext i1 %17 to i32
store i32 %18, i32* %3
br label %42
19: ; preds = %2
%20 = load i8, i8* %5
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 67
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = load i8, i8* %5
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 76
br label %27
27: ; preds = %23, %19
%28 = phi i1 [ true, %19 ], [ %26, %23 ]
%29 = zext i1 %28 to i32
store i32 %29, i32* %3
br label %42
30: ; preds = %2
%31 = load i8, i8* %5
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 68
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8, i8* %5
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 77
br label %38
38: ; preds = %34, %30
%39 = phi i1 [ true, %30 ], [ %37, %34 ]
%40 = zext i1 %39 to i32
store i32 %40, i32* %3
br label %42
41: ; preds = %2
store i32 0, i32* %3
br label %42
42: ; preds = %41, %38, %27, %16
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
define i32 @alg_can_come_before(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %16 [
i32 73, label %4
i32 88, label %8
i32 67, label %12
]
4: ; preds = %2
%5 = icmp eq i8 %1, 88
%6 = icmp eq i8 %1, 86
%7 = or i1 %5, %6
br label %16
8: ; preds = %2
%9 = icmp eq i8 %1, 67
%10 = icmp eq i8 %1, 76
%11 = or i1 %9, %10
br label %16
12: ; preds = %2
%13 = icmp eq i8 %1, 68
%14 = icmp eq i8 %1, 77
%15 = or i1 %13, %14
br label %16
16: ; preds = %2, %12, %8, %4
%17 = phi i1 [ %15, %12 ], [ %11, %8 ], [ %7, %4 ], [ false, %2 ]
%18 = zext i1 %17 to i32
ret i32 %18
}