#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 */
typedef int uint;

/* Variables and functions */
uint calculateCostOfLiteral(uint oldCost, uint litLen) {
  uint newCost = oldCost + 8;
  switch (litLen) {
  case 1:
  case 128:
    newCost++;
    break;
  case 2:
  case 4:
  case 8:
  case 16:
  case 32:
  case 64:
    newCost += 2;
    break;
  default:
    break;
  }
  return newCost;
}


x86 assembly (clang, -O0):
<calculateCostOfLiteral>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11a0 <calculateCostOfLiteral+0xa0>
jmp    1127 <calculateCostOfLiteral+0x27>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11ae <calculateCostOfLiteral+0xae>
jmp    1138 <calculateCostOfLiteral+0x38>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     11ae <calculateCostOfLiteral+0xae>
jmp    1149 <calculateCostOfLiteral+0x49>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     11ae <calculateCostOfLiteral+0xae>
jmp    115a <calculateCostOfLiteral+0x5a>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     11ae <calculateCostOfLiteral+0xae>
jmp    116b <calculateCostOfLiteral+0x6b>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     11ae <calculateCostOfLiteral+0xae>
jmp    117c <calculateCostOfLiteral+0x7c>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     11ae <calculateCostOfLiteral+0xae>
jmp    118d <calculateCostOfLiteral+0x8d>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
jne    11bc <calculateCostOfLiteral+0xbc>
jmp    11a0 <calculateCostOfLiteral+0xa0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c1 <calculateCostOfLiteral+0xc1>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    11c1 <calculateCostOfLiteral+0xc1>
jmp    11c1 <calculateCostOfLiteral+0xc1>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateCostOfLiteral>:
mov    %edi,%eax
lea    -0x1(%rsi),%ecx
cmp    $0x3f,%ecx
ja     1123 <calculateCostOfLiteral+0x23>
movabs $0x800000008000808a,%rdx
bt     %rcx,%rdx
jae    111e <calculateCostOfLiteral+0x1e>
add    $0xa,%eax
ret
test   %rcx,%rcx
je     112b <calculateCostOfLiteral+0x2b>
cmp    $0x80,%esi
jne    112f <calculateCostOfLiteral+0x2f>
add    $0x9,%eax
ret
add    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @calculateCostOfLiteral(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 8
store i32 %7, i32* %5
%8 = load i32, i32* %4
switch i32 %8, label %15 [
i32 1, label %9
i32 128, label %9
i32 2, label %12
i32 4, label %12
i32 8, label %12
i32 16, label %12
i32 32, label %12
i32 64, label %12
]
9: ; preds = %2, %2
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 1
store i32 %11, i32* %5
br label %16
12: ; preds = %2, %2, %2, %2, %2, %2
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 2
store i32 %14, i32* %5
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %12, %9
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @calculateCostOfLiteral(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 8
switch i32 %1, label %8 [
i32 1, label %4
i32 128, label %4
i32 2, label %6
i32 4, label %6
i32 8, label %6
i32 16, label %6
i32 32, label %6
i32 64, label %6
]
4: ; preds = %2, %2
%5 = add nsw i32 %0, 9
br label %8
6: ; preds = %2, %2, %2, %2, %2, %2
%7 = add nsw i32 %0, 10
br label %8
8: ; preds = %2, %6, %4
%9 = phi i32 [ %3, %2 ], [ %7, %6 ], [ %5, %4 ]
ret i32 %9
}