#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*/ error_msg(char *, char const *);
int /*<<< orphan*/ final_index_val(char const *);
int final_index_val0(char const *);
int /*<<< orphan*/ strcmp(char const *, char *);
int final_index_val_x(const char *s, const char *sym) {
  int r;
  if (!(r = final_index_val0(s))) {
    if (!strcmp(s, "IGNORE")) {
      r = 0;
    } else if (!strcmp(s, "..") || !strcmp(sym, "RANGE")) {
      if (*sym == '.') {
        final_index_val(sym);
      }
      r = 0x3fff;
    } else if (!strcmp(s, ".")) {
      r = 0x3ffe;
    } else {
      error_msg("can't find final index: %s", s);
    }
  }
  return r;
}


x86 assembly (clang, -O0):
<final_index_val_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <final_index_val0@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    1225 <final_index_val_x+0xe5>
mov    -0x8(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    118a <final_index_val_x+0x4a>
movl   $0x0,-0x14(%rbp)
jmp    1220 <final_index_val_x+0xe0>
mov    -0x8(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     11bc <final_index_val_x+0x7c>
mov    -0x10(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11e1 <final_index_val_x+0xa1>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11d5 <final_index_val_x+0x95>
mov    -0x10(%rbp),%rdi
call   1060 <final_index_val@plt>
movl   $0x3fff,-0x14(%rbp)
jmp    121b <final_index_val_x+0xdb>
mov    -0x8(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1206 <final_index_val_x+0xc6>
movl   $0x3ffe,-0x14(%rbp)
jmp    1216 <final_index_val_x+0xd6>
mov    -0x8(%rbp),%rsi
lea    0xdff(%rip),%rdi
call   1030 <error_msg@plt>
jmp    121b <final_index_val_x+0xdb>
jmp    1220 <final_index_val_x+0xe0>
jmp    1225 <final_index_val_x+0xe5>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<final_index_val_x>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1050 <final_index_val0@plt>
mov    %eax,%ebx
test   %eax,%eax
je     115e <final_index_val_x+0x1e>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe9b(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     1156 <final_index_val_x+0x16>
lea    0xe8d(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11bd <final_index_val_x+0x7d>
lea    0xe7d(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11bd <final_index_val_x+0x7d>
lea    0xe68(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11d2 <final_index_val_x+0x92>
lea    0xe5d(%rip),%rdi
mov    %r14,%rsi
call   1030 <error_msg@plt>
jmp    1156 <final_index_val_x+0x16>
mov    $0x3fff,%ebx
cmpb   $0x2e,(%r15)
jne    1156 <final_index_val_x+0x16>
mov    %r15,%rdi
call   1060 <final_index_val@plt>
jmp    1156 <final_index_val_x+0x16>
mov    $0x3ffe,%ebx
jmp    1156 <final_index_val_x+0x16>

LLVM IR (-O0):
@.str = [7 x i8] c"IGNORE\00"
@.str.1 = [3 x i8] c"..\00"
@.str.2 = [6 x i8] c"RANGE\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [27 x i8] c"can't find final index: %s\00"
define i32 @final_index_val_x(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @final_index_val0(i8* %6)
store i32 %7, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %42, label %9
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
store i32 0, i32* %5
br label %41
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %18, %14
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 46
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = call i32 @final_index_val(i8* %28)
br label %30
30: ; preds = %27, %22
store i32 16383, i32* %5
br label %40
31: ; preds = %18
%32 = load i8*, i8** %3
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %31
store i32 16382, i32* %5
br label %39
36: ; preds = %31
%37 = load i8*, i8** %3
%38 = call i32 @error_msg(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %36, %35
br label %40
40: ; preds = %39, %30
br label %41
41: ; preds = %40, %13
br label %42
42: ; preds = %41, %2
%43 = load i32, i32* %5
ret i32 %43
}

LLVM IR (-O2):
@.str = [7 x i8] c"IGNORE\00"
@.str.1 = [3 x i8] c"..\00"
@.str.2 = [6 x i8] c"RANGE\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [27 x i8] c"can't find final index: %s\00"
define i32 @final_index_val_x(i8* %0, i8* %1) {
%3 = tail call i32 @final_index_val0(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %24
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %24, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11, %8
%15 = load i8, i8* %1
%16 = icmp eq i8 %15, 46
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = tail call i32 @final_index_val(i8* %1)
br label %24
19: ; preds = %11
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = tail call i32 @error_msg(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %24
24: ; preds = %19, %14, %17, %5, %22, %2
%25 = phi i32 [ %3, %2 ], [ 0, %22 ], [ 0, %5 ], [ 16383, %17 ], [ 16383, %14 ], [ 16382, %19 ]
ret i32 %25
}