int dcbCleanupSize_x86_this_ms(const char *signature) {
  const char *ptr = signature;
  int size = 0;
  char ch;
  while ((ch = *ptr++) != ')') {
    switch (ch) {
    case 'B':
    case 'c':
    case 's':
    case 'i':
    case 'j':
    case 'p':
    case 'C':
    case 'S':
    case 'I':
    case 'J':
    case 'Z':
    case 'f':
      size += 4;
      break;
    case 'd':
    case 'l':
    case 'L':
      size += 8;
      break;
    }
  }
  return size;
}


x86 assembly (clang, -O0):
<dcbCleanupSize_x86_this_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x15(%rbp)
movsbl %al,%eax
cmp    $0x29,%eax
je     122c <dcbCleanupSize_x86_this_ms+0x12c>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
add    $0xffffffbe,%eax
sub    $0x2,%eax
jb     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    114f <dcbCleanupSize_x86_this_ms+0x4f>
mov    -0x1c(%rbp),%eax
add    $0xffffffb7,%eax
sub    $0x2,%eax
jb     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    1163 <dcbCleanupSize_x86_this_ms+0x63>
mov    -0x1c(%rbp),%eax
sub    $0x4c,%eax
je     121e <dcbCleanupSize_x86_this_ms+0x11e>
jmp    1174 <dcbCleanupSize_x86_this_ms+0x74>
mov    -0x1c(%rbp),%eax
sub    $0x53,%eax
je     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    1185 <dcbCleanupSize_x86_this_ms+0x85>
mov    -0x1c(%rbp),%eax
sub    $0x5a,%eax
je     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    1196 <dcbCleanupSize_x86_this_ms+0x96>
mov    -0x1c(%rbp),%eax
sub    $0x63,%eax
je     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    11a7 <dcbCleanupSize_x86_this_ms+0xa7>
mov    -0x1c(%rbp),%eax
sub    $0x64,%eax
je     121e <dcbCleanupSize_x86_this_ms+0x11e>
jmp    11b8 <dcbCleanupSize_x86_this_ms+0xb8>
mov    -0x1c(%rbp),%eax
sub    $0x66,%eax
je     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    11c9 <dcbCleanupSize_x86_this_ms+0xc9>
mov    -0x1c(%rbp),%eax
add    $0xffffff97,%eax
sub    $0x2,%eax
jb     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    11dd <dcbCleanupSize_x86_this_ms+0xdd>
mov    -0x1c(%rbp),%eax
sub    $0x6c,%eax
je     121e <dcbCleanupSize_x86_this_ms+0x11e>
jmp    11ee <dcbCleanupSize_x86_this_ms+0xee>
mov    -0x1c(%rbp),%eax
sub    $0x70,%eax
je     1210 <dcbCleanupSize_x86_this_ms+0x110>
jmp    11ff <dcbCleanupSize_x86_this_ms+0xff>
mov    -0x1c(%rbp),%eax
sub    $0x73,%eax
jne    1227 <dcbCleanupSize_x86_this_ms+0x127>
jmp    1210 <dcbCleanupSize_x86_this_ms+0x110>
mov    -0x14(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    1227 <dcbCleanupSize_x86_this_ms+0x127>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <dcbCleanupSize_x86_this_ms+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcbCleanupSize_x86_this_ms>:
mov    (%rdi),%dl
xor    %eax,%eax
cmp    $0x29,%dl
jne    110a <dcbCleanupSize_x86_this_ms+0xa>
ret
add    $0x1,%rdi
xor    %eax,%eax
movabs $0x2419201020183,%rcx
movabs $0x40400000400,%rsi
jmp    113f <dcbCleanupSize_x86_this_ms+0x3f>
cs nopw 0x0(%rax,%rax,1)
add    $0x4,%eax
movzbl (%rdi),%edx
add    $0x1,%rdi
cmp    $0x29,%dl
je     1109 <dcbCleanupSize_x86_this_ms+0x9>
movsbl %dl,%edx
add    $0xffffffbe,%edx
cmp    $0x31,%edx
ja     1133 <dcbCleanupSize_x86_this_ms+0x33>
bt     %rdx,%rcx
jb     1130 <dcbCleanupSize_x86_this_ms+0x30>
bt     %rdx,%rsi
jae    1133 <dcbCleanupSize_x86_this_ms+0x33>
add    $0x8,%eax
jmp    1133 <dcbCleanupSize_x86_this_ms+0x33>

LLVM IR (-O0):
define i32 @dcbCleanupSize_x86_this_ms(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
store i32 0, i32* %4
br label %7
7: ; preds = %22, %1
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %3
%10 = load i8, i8* %8
store i8 %10, i8* %5
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 41
br i1 %12, label %13, label %23
13: ; preds = %7
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
switch i32 %15, label %22 [
i32 66, label %16
i32 99, label %16
i32 115, label %16
i32 105, label %16
i32 106, label %16
i32 112, label %16
i32 67, label %16
i32 83, label %16
i32 73, label %16
i32 74, label %16
i32 90, label %16
i32 102, label %16
i32 100, label %19
i32 108, label %19
i32 76, label %19
]
16: ; preds = %13, %13, %13, %13, %13, %13, %13, %13, %13, %13, %13, %13
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 4
store i32 %18, i32* %4
br label %22
19: ; preds = %13, %13, %13
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 8
store i32 %21, i32* %4
br label %22
22: ; preds = %13, %19, %16
br label %7
23: ; preds = %7
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
define i32 @dcbCleanupSize_x86_this_ms(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 41
br i1 %3, label %18, label %4
4: ; preds = %1, %14
%5 = phi i8 [ %16, %14 ], [ %2, %1 ]
%6 = phi i8* [ %8, %14 ], [ %0, %1 ]
%7 = phi i32 [ %15, %14 ], [ 0, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = sext i8 %5 to i32
switch i32 %9, label %14 [
i32 66, label %10
i32 99, label %10
i32 115, label %10
i32 105, label %10
i32 106, label %10
i32 112, label %10
i32 67, label %10
i32 83, label %10
i32 73, label %10
i32 74, label %10
i32 90, label %10
i32 102, label %10
i32 100, label %12
i32 108, label %12
i32 76, label %12
]
10: ; preds = %4, %4, %4, %4, %4, %4, %4, %4, %4, %4, %4, %4
%11 = add nsw i32 %7, 4
br label %14
12: ; preds = %4, %4, %4
%13 = add nsw i32 %7, 8
br label %14
14: ; preds = %4, %12, %10
%15 = phi i32 [ %7, %4 ], [ %13, %12 ], [ %11, %10 ]
%16 = load i8, i8* %8
%17 = icmp eq i8 %16, 41
br i1 %17, label %18, label %4
18: ; preds = %14, %1
%19 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %19
}