#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 atoi(char const *);
unsigned char binimage_parse_flash_freq(const char *str) {
  int val = atoi(str);
  switch (val) {
  case 40:
    return 0x0;
  case 26:
    return 0x1;
  case 20:
    return 0x2;
  case 80:
    return 0xf;
  default:
    return 0xff;
  }
}


x86 assembly (clang, -O0):
<binimage_parse_flash_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x14,%eax
je     1181 <binimage_parse_flash_freq+0x71>
jmp    113c <binimage_parse_flash_freq+0x2c>
mov    -0x18(%rbp),%eax
sub    $0x1a,%eax
je     1178 <binimage_parse_flash_freq+0x68>
jmp    114d <binimage_parse_flash_freq+0x3d>
mov    -0x18(%rbp),%eax
sub    $0x28,%eax
je     116f <binimage_parse_flash_freq+0x5f>
jmp    115e <binimage_parse_flash_freq+0x4e>
mov    -0x18(%rbp),%eax
sub    $0x50,%eax
je     118a <binimage_parse_flash_freq+0x7a>
jmp    1193 <binimage_parse_flash_freq+0x83>
movb   $0x0,-0x1(%rbp)
jmp    1197 <binimage_parse_flash_freq+0x87>
movb   $0x1,-0x1(%rbp)
jmp    1197 <binimage_parse_flash_freq+0x87>
movb   $0x2,-0x1(%rbp)
jmp    1197 <binimage_parse_flash_freq+0x87>
movb   $0xf,-0x1(%rbp)
jmp    1197 <binimage_parse_flash_freq+0x87>
movb   $0xff,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binimage_parse_flash_freq>:
push   %rax
call   1030 <atoi@plt>
cmp    $0x27,%eax
jg     1129 <binimage_parse_flash_freq+0x19>
cmp    $0x14,%eax
je     113b <binimage_parse_flash_freq+0x2b>
cmp    $0x1a,%eax
jne    1137 <binimage_parse_flash_freq+0x27>
mov    $0x1,%al
pop    %rcx
ret
cmp    $0x28,%eax
je     113f <binimage_parse_flash_freq+0x2f>
cmp    $0x50,%eax
jne    1137 <binimage_parse_flash_freq+0x27>
mov    $0xf,%al
pop    %rcx
ret
mov    $0xff,%al
pop    %rcx
ret
mov    $0x2,%al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @binimage_parse_flash_freq(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @atoi(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
switch i32 %7, label %12 [
i32 40, label %8
i32 26, label %9
i32 20, label %10
i32 80, label %11
]
8: ; preds = %1
store i8 0, i8* %2
br label %13
9: ; preds = %1
store i8 1, i8* %2
br label %13
10: ; preds = %1
store i8 2, i8* %2
br label %13
11: ; preds = %1
store i8 15, i8* %2
br label %13
12: ; preds = %1
store i8 -1, i8* %2
br label %13
13: ; preds = %12, %11, %10, %9, %8
%14 = load i8, i8* %2
ret i8 %14
}

LLVM IR (-O2):
define zeroext i8 @binimage_parse_flash_freq(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
switch i32 %2, label %6 [
i32 40, label %7
i32 26, label %3
i32 20, label %4
i32 80, label %5
]
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %4, %3
%8 = phi i8 [ -1, %6 ], [ 15, %5 ], [ 2, %4 ], [ 1, %3 ], [ 0, %1 ]
ret i8 %8
}