#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 int64_t;

/* Variables and functions */
char getchar();
int64_t set_unit(void) {
  char unit = '\n';
  int64_t mult;
  while ((unit != 'n') && (unit != 'u') && (unit != 'm') && (unit != '0') &&
         (unit != 'k')) {
    unit = getchar();
  }
  switch (unit) {
  case 'n':
    mult = 0;
    break;
  case 'u':
    mult = 1000;
    break;
  case 'm':
    mult = 1000000;
    break;
  case '0':
    mult = 1000000000;
    break;
  case 'k':
    mult = 1000000000000;
  }
  return mult;
}


x86 assembly (clang, -O0):
<set_unit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0xa,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x9(%rbp)
je     1171 <set_unit+0x61>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x75,%ecx
mov    %al,-0x9(%rbp)
je     1171 <set_unit+0x61>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6d,%ecx
mov    %al,-0x9(%rbp)
je     1171 <set_unit+0x61>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x9(%rbp)
je     1171 <set_unit+0x61>
movsbl -0x1(%rbp),%eax
cmp    $0x6b,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1181 <set_unit+0x71>
jmp    1190 <set_unit+0x80>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
jmp    111c <set_unit+0xc>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x30,%eax
je     120d <set_unit+0xfd>
jmp    11a5 <set_unit+0x95>
mov    -0x10(%rbp),%eax
sub    $0x6b,%eax
je     1219 <set_unit+0x109>
jmp    11b6 <set_unit+0xa6>
mov    -0x10(%rbp),%eax
sub    $0x6d,%eax
je     1201 <set_unit+0xf1>
jmp    11c7 <set_unit+0xb7>
mov    -0x10(%rbp),%eax
sub    $0x6e,%eax
je     11e9 <set_unit+0xd9>
jmp    11d8 <set_unit+0xc8>
mov    -0x10(%rbp),%eax
sub    $0x75,%eax
je     11f5 <set_unit+0xe5>
jmp    1220 <set_unit+0x110>
movl   $0x0,-0x8(%rbp)
jmp    1220 <set_unit+0x110>
movl   $0x3e8,-0x8(%rbp)
jmp    1220 <set_unit+0x110>
movl   $0xf4240,-0x8(%rbp)
jmp    1220 <set_unit+0x110>
movl   $0x3b9aca00,-0x8(%rbp)
jmp    1220 <set_unit+0x110>
movl   $0xd4a51000,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_unit>:
push   %rbx
mov    $0xa,%al
lea    0xee6(%rip),%rbx
jmp    112b <set_unit+0x1b>
nopl   0x0(%rax)
cmp    $0x30,%al
je     1158 <set_unit+0x48>
xor    %eax,%eax
call   1030 <getchar@plt>
lea    -0x6b(%rax),%ecx
cmp    $0xa,%cl
ja     1120 <set_unit+0x10>
movzbl %cl,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    $0xd4a51000,%eax
pop    %rbx
ret
mov    $0xf4240,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x3e8,%eax
pop    %rbx
ret
mov    $0x3b9aca00,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @set_unit() {
%1 = alloca i8
%2 = alloca i32
store i8 10, i8* %1
br label %3
3: ; preds = %25, %0
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 110
br i1 %6, label %7, label %23
7: ; preds = %3
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 117
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 109
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i8, i8* %1
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 48
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8, i8* %1
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 107
br label %23
23: ; preds = %19, %15, %11, %7, %3
%24 = phi i1 [ false, %15 ], [ false, %11 ], [ false, %7 ], [ false, %3 ], [ %22, %19 ]
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = call signext i8 (...) @getchar()
store i8 %26, i8* %1
br label %3
27: ; preds = %23
%28 = load i8, i8* %1
%29 = sext i8 %28 to i32
switch i32 %29, label %35 [
i32 110, label %30
i32 117, label %31
i32 109, label %32
i32 48, label %33
i32 107, label %34
]
30: ; preds = %27
store i32 0, i32* %2
br label %35
31: ; preds = %27
store i32 1000, i32* %2
br label %35
32: ; preds = %27
store i32 1000000, i32* %2
br label %35
33: ; preds = %27
store i32 1000000000, i32* %2
br label %35
34: ; preds = %27
store i32 -727379968, i32* %2
br label %35
35: ; preds = %34, %27, %33, %32, %31, %30
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @set_unit() {
br label %1
1: ; preds = %3, %0
%2 = phi i8 [ 10, %0 ], [ %4, %3 ]
switch i8 %2, label %3 [
i8 107, label %8
i8 117, label %5
i8 109, label %6
i8 48, label %7
i8 110, label %9
]
3: ; preds = %1
%4 = tail call signext i8 (...) @getchar()
br label %1
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5
%10 = phi i32 [ 1000, %5 ], [ 1000000, %6 ], [ 1000000000, %7 ], [ -727379968, %8 ], [ 0, %1 ]
ret i32 %10
}