#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 /*<<< orphan*/ *index(char *, char);
int check_runlevels(char *prevlevel, char *actlevel) {
  if (prevlevel == NULL || actlevel == NULL)
    return 1;
  if (!((index("N"
               "S0123456",
               prevlevel[0]) != NULL) &&
        (index("S0123456", actlevel[0]) != NULL)))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<check_runlevels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <check_runlevels+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <check_runlevels+0x32>
movl   $0x1,-0x4(%rbp)
jmp    118f <check_runlevels+0x7f>
mov    -0x10(%rbp),%rax
lea    0xeb3(%rip),%rdi
movsbl (%rax),%esi
call   1030 <index@plt>
cmp    $0x0,%rax
je     117c <check_runlevels+0x6c>
mov    -0x18(%rbp),%rax
lea    0xe97(%rip),%rdi
movsbl (%rax),%esi
call   1030 <index@plt>
cmp    $0x0,%rax
jne    1188 <check_runlevels+0x78>
movl   $0x1,-0x4(%rbp)
jmp    118f <check_runlevels+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_runlevels>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
test   %rdi,%rdi
je     1152 <check_runlevels+0x42>
mov    %rsi,%r14
test   %rsi,%rsi
je     1152 <check_runlevels+0x42>
movsbl (%rdi),%esi
lea    0xed0(%rip),%rdi
call   1030 <index@plt>
test   %rax,%rax
je     1152 <check_runlevels+0x42>
movsbl (%r14),%esi
lea    0xebc(%rip),%rdi
call   1030 <index@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"NS0123456\00"
@.str.1 = [9 x i8] c"S0123456\00"
define i32 @check_runlevels(i8* %0, i8* %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 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 1, i32* %3
br label %26
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = call i32* @index(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext %15)
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = call i32* @index(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8 signext %21)
%23 = icmp ne i32* %22, null
br i1 %23, label %25, label %24
24: ; preds = %18, %12
store i32 1, i32* %3
br label %26
25: ; preds = %18
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %11
%27 = load i32, i32* %3
ret i32 %27
}

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