#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 */
int /*<<< orphan*/ assert(char const *);
int multiplier_affix(const char *str) {
  const char *i;
  int multiplier = 1;
  assert(str);
  for (i = str;; ++i) {
    char c = *i;
    if (!c)
      break;
    switch (c) {
    case 'k':
    case 'K':
      multiplier *= 1000;
      break;
    case 'm':
    case 'M':
      multiplier *= 1000000;
      break;
    case 'g':
    case 'G':
      multiplier *= 1000000000;
      break;
    }
  }
  return multiplier;
}


x86 assembly (clang, -O0):
<multiplier_affix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x15(%rbp)
cmpb   $0x0,-0x15(%rbp)
jne    114c <multiplier_affix+0x3c>
jmp    11f4 <multiplier_affix+0xe4>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x47,%eax
je     11d4 <multiplier_affix+0xc4>
jmp    1161 <multiplier_affix+0x51>
mov    -0x1c(%rbp),%eax
sub    $0x4b,%eax
je     11b6 <multiplier_affix+0xa6>
jmp    1172 <multiplier_affix+0x62>
mov    -0x1c(%rbp),%eax
sub    $0x4d,%eax
je     11c5 <multiplier_affix+0xb5>
jmp    1183 <multiplier_affix+0x73>
mov    -0x1c(%rbp),%eax
sub    $0x67,%eax
je     11d4 <multiplier_affix+0xc4>
jmp    1194 <multiplier_affix+0x84>
mov    -0x1c(%rbp),%eax
sub    $0x6b,%eax
je     11b6 <multiplier_affix+0xa6>
jmp    11a5 <multiplier_affix+0x95>
mov    -0x1c(%rbp),%eax
sub    $0x6d,%eax
je     11c5 <multiplier_affix+0xb5>
jmp    11de <multiplier_affix+0xce>
imul   $0x3e8,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11de <multiplier_affix+0xce>
imul   $0xf4240,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11de <multiplier_affix+0xce>
imul   $0x3b9aca00,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11e3 <multiplier_affix+0xd3>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <multiplier_affix+0x24>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiplier_affix>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    (%rbx),%dl
test   %dl,%dl
je     119a <multiplier_affix+0x8a>
add    $0x1,%rbx
mov    $0x1,%eax
movabs $0x100000001,%rcx
movabs $0x1000000010,%rdi
movabs $0x4000000040,%rsi
jmp    1161 <multiplier_affix+0x51>
nopl   0x0(%rax,%rax,1)
imul   $0x3b9aca00,%eax,%eax
movzbl (%rbx),%edx
add    $0x1,%rbx
test   %dl,%dl
je     1198 <multiplier_affix+0x88>
movsbl %dl,%edx
add    $0xffffffb9,%edx
cmp    $0x26,%edx
ja     1156 <multiplier_affix+0x46>
bt     %rdx,%rcx
jb     1150 <multiplier_affix+0x40>
bt     %rdx,%rdi
jb     1190 <multiplier_affix+0x80>
bt     %rdx,%rsi
jae    1156 <multiplier_affix+0x46>
imul   $0xf4240,%eax,%eax
jmp    1156 <multiplier_affix+0x46>
cs nopw 0x0(%rax,%rax,1)
imul   $0x3e8,%eax,%eax
jmp    1156 <multiplier_affix+0x46>
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @multiplier_affix(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %2
store i32 1, i32* %4
%6 = load i8*, i8** %2
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %2
store i8* %8, i8** %3
br label %9
9: ; preds = %28, %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
store i8 %11, i8* %5
%12 = load i8, i8* %5
%13 = icmp ne i8 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %9
br label %31
15: ; preds = %9
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
switch i32 %17, label %27 [
i32 107, label %18
i32 75, label %18
i32 109, label %21
i32 77, label %21
i32 103, label %24
i32 71, label %24
]
18: ; preds = %15, %15
%19 = load i32, i32* %4
%20 = mul nsw i32 %19, 1000
store i32 %20, i32* %4
br label %27
21: ; preds = %15, %15
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 1000000
store i32 %23, i32* %4
br label %27
24: ; preds = %15, %15
%25 = load i32, i32* %4
%26 = mul nsw i32 %25, 1000000000
store i32 %26, i32* %4
br label %27
27: ; preds = %15, %24, %21, %18
br label %28
28: ; preds = %27
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
br label %9
31: ; preds = %14
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @multiplier_affix(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %21, label %5
5: ; preds = %1, %16
%6 = phi i8 [ %19, %16 ], [ %3, %1 ]
%7 = phi i8* [ %18, %16 ], [ %0, %1 ]
%8 = phi i32 [ %17, %16 ], [ 1, %1 ]
%9 = sext i8 %6 to i32
switch i32 %9, label %16 [
i32 107, label %10
i32 75, label %10
i32 109, label %12
i32 77, label %12
i32 103, label %14
i32 71, label %14
]
10: ; preds = %5, %5
%11 = mul nsw i32 %8, 1000
br label %16
12: ; preds = %5, %5
%13 = mul nsw i32 %8, 1000000
br label %16
14: ; preds = %5, %5
%15 = mul nsw i32 %8, 1000000000
br label %16
16: ; preds = %5, %14, %12, %10
%17 = phi i32 [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %8, %5 ]
%18 = getelementptr inbounds i8, i8* %7, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %5
21: ; preds = %16, %1
%22 = phi i32 [ 1, %1 ], [ %17, %16 ]
ret i32 %22
}