#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 uintmax_t;
typedef int intmax_t;

/* Variables and functions */
intmax_t postfix_to_mult(const char expr) {
  intmax_t mult;
  mult = 0;
  switch (expr) {
  case 'B':
  case 'b':
    mult = 512;
    break;
  case 'K':
  case 'k':
    mult = 1 << 10;
    break;
  case 'M':
  case 'm':
    mult = 1 << 20;
    break;
  case 'G':
  case 'g':
    mult = 1 << 30;
    break;
  case 'T':
  case 't':
    mult = (uintmax_t)1 << 40;
    break;
  case 'P':
  case 'p':
    mult = (uintmax_t)1 << 50;
    break;
  case 'W':
  case 'w':
    mult = sizeof(int);
    break;
  }
  return (mult);
}


x86 assembly (clang, -O0):
<postfix_to_mult>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffbe,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x35,%eax
ja     1182 <postfix_to_mult+0x82>
mov    -0x10(%rbp),%rax
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x200,-0x8(%rbp)
jmp    1182 <postfix_to_mult+0x82>
movl   $0x400,-0x8(%rbp)
jmp    1182 <postfix_to_mult+0x82>
movl   $0x100000,-0x8(%rbp)
jmp    1182 <postfix_to_mult+0x82>
movl   $0x40000000,-0x8(%rbp)
jmp    1182 <postfix_to_mult+0x82>
mov    %eax,-0x8(%rbp)
jmp    1182 <postfix_to_mult+0x82>
mov    %eax,-0x8(%rbp)
jmp    1182 <postfix_to_mult+0x82>
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<postfix_to_mult>:
xor    %eax,%eax
add    $0xffffffbe,%edi
cmp    $0x35,%edi
ja     1137 <postfix_to_mult+0x37>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x200,%eax
ret
mov    $0x40000000,%eax
ret
mov    $0x400,%eax
ret
mov    $0x100000,%eax
ret
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @postfix_to_mult(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %13 [
i32 66, label %6
i32 98, label %6
i32 75, label %7
i32 107, label %7
i32 77, label %8
i32 109, label %8
i32 71, label %9
i32 103, label %9
i32 84, label %10
i32 116, label %10
i32 80, label %11
i32 112, label %11
i32 87, label %12
i32 119, label %12
]
6: ; preds = %1, %1
store i32 512, i32* %3
br label %13
7: ; preds = %1, %1
store i32 1024, i32* %3
br label %13
8: ; preds = %1, %1
store i32 1048576, i32* %3
br label %13
9: ; preds = %1, %1
store i32 1073741824, i32* %3
br label %13
10: ; preds = %1, %1
store i32 poison, i32* %3
br label %13
11: ; preds = %1, %1
store i32 poison, i32* %3
br label %13
12: ; preds = %1, %1
store i32 4, i32* %3
br label %13
13: ; preds = %1, %12, %11, %10, %9, %8, %7, %6
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @postfix_to_mult(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %8 [
i32 66, label %3
i32 98, label %3
i32 75, label %4
i32 107, label %4
i32 77, label %5
i32 109, label %5
i32 71, label %6
i32 103, label %6
i32 119, label %7
i32 87, label %7
]
3: ; preds = %1, %1
br label %8
4: ; preds = %1, %1
br label %8
5: ; preds = %1, %1
br label %8
6: ; preds = %1, %1
br label %8
7: ; preds = %1, %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3
%9 = phi i32 [ 4, %7 ], [ 1073741824, %6 ], [ 1048576, %5 ], [ 1024, %4 ], [ 512, %3 ], [ 0, %1 ]
ret i32 %9
}