#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 */
long strtol(char *, char **, int);
long bytes_from_multiplier(char *inString) {
  long value = 0;
  long factor = 1;
  char *suffix;
  value = strtol(inString, &suffix, 10);
  if (suffix) {
    switch (*suffix) {
    case 'G':
      factor = 1 << 30;
      break;
    case 'M':
      factor = 1 << 20;
      break;
    case 'K':
      factor = 1 << 10;
      break;
    default:
      break;
    }
  }
  return (value * factor);
}


x86 assembly (clang, -O0):
<bytes_from_multiplier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11b8 <bytes_from_multiplier+0xa8>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
sub    $0x47,%eax
je     1187 <bytes_from_multiplier+0x77>
jmp    1165 <bytes_from_multiplier+0x55>
mov    -0x24(%rbp),%eax
sub    $0x4b,%eax
je     11a1 <bytes_from_multiplier+0x91>
jmp    1176 <bytes_from_multiplier+0x66>
mov    -0x24(%rbp),%eax
sub    $0x4d,%eax
je     1194 <bytes_from_multiplier+0x84>
jmp    11ae <bytes_from_multiplier+0x9e>
movq   $0x40000000,-0x18(%rbp)
40
jmp    11b3 <bytes_from_multiplier+0xa3>
movq   $0x100000,-0x18(%rbp)
jmp    11b3 <bytes_from_multiplier+0xa3>
movq   $0x400,-0x18(%rbp)
jmp    11b3 <bytes_from_multiplier+0xa3>
jmp    11b3 <bytes_from_multiplier+0xa3>
jmp    11b8 <bytes_from_multiplier+0xa8>
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_from_multiplier>:
push   %rax
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    (%rsp),%rdx
mov    $0x1,%ecx
test   %rdx,%rdx
je     1149 <bytes_from_multiplier+0x39>
movsbl (%rdx),%edx
lea    -0x47(%rdx),%esi
cmp    $0x6,%esi
ja     1149 <bytes_from_multiplier+0x39>
movslq %edx,%rcx
lea    0xebf(%rip),%rdx
mov    -0x238(%rdx,%rcx,8),%rcx
ff
imul   %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @bytes_from_multiplier(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %2
store i64 0, i64* %3
store i64 1, i64* %4
%6 = load i8*, i8** %2
%7 = call i64 @strtol(i8* %6, i8** %5, i32 10)
store i64 %7, i64* %3
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %19
10: ; preds = %1
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
switch i32 %13, label %17 [
i32 71, label %14
i32 77, label %15
i32 75, label %16
]
14: ; preds = %10
store i64 1073741824, i64* %4
br label %18
15: ; preds = %10
store i64 1048576, i64* %4
br label %18
16: ; preds = %10
store i64 1024, i64* %4
br label %18
17: ; preds = %10
br label %18
18: ; preds = %17, %16, %15, %14
br label %19
19: ; preds = %18, %1
%20 = load i64, i64* %3
%21 = load i64, i64* %4
%22 = mul nsw i64 %20, %21
ret i64 %22
}

LLVM IR (-O2):
@switch.table.bytes_from_multiplier = [7 x i64] [i64 1073741824, i64 1, i64 1, i64 1, i64 1024, i64 1, i64 1048576]
define i64 @bytes_from_multiplier(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 10)
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %16, label %7
7: ; preds = %1
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, -71
%11 = icmp ult i32 %10, 7
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = sext i32 %10 to i64
%14 = getelementptr inbounds [7 x i64], [7 x i64]* @switch.table.bytes_from_multiplier, i64 0, i64 %13
%15 = load i64, i64* %14
br label %16
16: ; preds = %12, %7, %1
%17 = phi i64 [ 1, %7 ], [ 1, %1 ], [ %15, %12 ]
%18 = mul nsw i64 %17, %4
ret i64 %18
}