#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 */
char characterClass(char, char);
int insertOrDeleteCost(char cPrev, char c) {
  char classC = characterClass(cPrev, c);
  char classCprev;
  if (classC == 0) {
    return 1;
  }
  if (cPrev == c) {
    return 10;
  }
  classCprev = characterClass(cPrev, cPrev);
  if (classC == classCprev) {
    if (classC == 1) {
      return 15;
    } else {
      return 50;
    }
  }
  return 100;
}


x86 assembly (clang, -O0):
<insertOrDeleteCost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x6(%rbp),%esi
call   1030 <characterClass@plt>
mov    %al,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0x0,%eax
jne    114f <insertOrDeleteCost+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    11b9 <insertOrDeleteCost+0xa9>
movsbl -0x5(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jne    116b <insertOrDeleteCost+0x5b>
movl   $0xa,-0x4(%rbp)
jmp    11b9 <insertOrDeleteCost+0xa9>
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x5(%rbp),%esi
call   1030 <characterClass@plt>
mov    %al,-0x8(%rbp)
movsbl -0x7(%rbp),%eax
movsbl -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    11b2 <insertOrDeleteCost+0xa2>
movsbl -0x7(%rbp),%eax
cmp    $0x1,%eax
jne    11a6 <insertOrDeleteCost+0x96>
movl   $0xf,-0x4(%rbp)
jmp    11b9 <insertOrDeleteCost+0xa9>
movl   $0x32,-0x4(%rbp)
jmp    11b9 <insertOrDeleteCost+0xa9>
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertOrDeleteCost>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <characterClass@plt>
test   %al,%al
je     1158 <insertOrDeleteCost+0x48>
mov    %eax,%r14d
mov    $0xa,%eax
cmp    %bl,%bpl
je     115d <insertOrDeleteCost+0x4d>
movsbl %bpl,%edi
mov    %edi,%esi
call   1030 <characterClass@plt>
mov    %eax,%ecx
mov    $0x64,%eax
cmp    %cl,%r14b
jne    115d <insertOrDeleteCost+0x4d>
cmp    $0x1,%r14b
mov    $0xf,%ecx
mov    $0x32,%eax
cmove  %ecx,%eax
jmp    115d <insertOrDeleteCost+0x4d>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @insertOrDeleteCost(i8 signext %0, i8 signext %1) {
%3 = tail call signext i8 @characterClass(i8 signext %0, i8 signext %1)
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = icmp eq i8 %0, %1
br i1 %6, label %13, label %7
7: ; preds = %5
%8 = tail call signext i8 @characterClass(i8 signext %0, i8 signext %0)
%9 = icmp eq i8 %3, %8
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = icmp eq i8 %3, 1
%12 = select i1 %11, i32 15, i32 50
br label %13
13: ; preds = %7, %10, %5, %2
%14 = phi i32 [ 1, %2 ], [ 10, %5 ], [ %12, %10 ], [ 100, %7 ]
ret i32 %14
}