#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 uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
uint8_t validate(uint16_t bsize) {
  switch (bsize) {
  case 512:
    return 0;
  case 1024:
    return 1;
  case 2048:
    return 2;
  case 4096:
    return 3;
  case 8192:
    return 4;
  case 16384:
    return 5;
  default:
    fprintf(stderr, "mkfs: unsupported block size.\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<validate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x200,%eax
je     11a0 <validate+0x80>
jmp    1141 <validate+0x21>
mov    -0xc(%rbp),%eax
sub    $0x400,%eax
je     11ac <validate+0x8c>
jmp    1154 <validate+0x34>
mov    -0xc(%rbp),%eax
sub    $0x800,%eax
je     11b8 <validate+0x98>
jmp    1167 <validate+0x47>
mov    -0xc(%rbp),%eax
sub    $0x1000,%eax
je     11c4 <validate+0xa4>
jmp    117a <validate+0x5a>
mov    -0xc(%rbp),%eax
sub    $0x2000,%eax
je     11d0 <validate+0xb0>
jmp    118d <validate+0x6d>
mov    -0xc(%rbp),%eax
sub    $0x4000,%eax
je     11dc <validate+0xbc>
jmp    11e8 <validate+0xc8>
movl   $0x0,-0x4(%rbp)
jmp    1207 <validate+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    1207 <validate+0xe7>
movl   $0x2,-0x4(%rbp)
jmp    1207 <validate+0xe7>
movl   $0x3,-0x4(%rbp)
jmp    1207 <validate+0xe7>
movl   $0x4,-0x4(%rbp)
jmp    1207 <validate+0xe7>
movl   $0x5,-0x4(%rbp)
jmp    1207 <validate+0xe7>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
lea    0xe08(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate>:
cmp    $0xfff,%edi
jg     1146 <validate+0x26>
cmp    $0x200,%edi
je     1164 <validate+0x44>
cmp    $0x400,%edi
je     1167 <validate+0x47>
cmp    $0x800,%edi
jne    1179 <validate+0x59>
mov    $0x2,%eax
ret
cmp    $0x1000,%edi
je     116d <validate+0x4d>
cmp    $0x2000,%edi
je     1173 <validate+0x53>
cmp    $0x4000,%edi
jne    1179 <validate+0x59>
mov    $0x5,%eax
ret
xor    %eax,%eax
ret
mov    $0x1,%eax
ret
mov    $0x3,%eax
ret
mov    $0x4,%eax
ret
push   %rax
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"mkfs: unsupported block size.\0A\00"
define i32 @validate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 512, label %5
i32 1024, label %6
i32 2048, label %7
i32 4096, label %8
i32 8192, label %9
i32 16384, label %10
]
5: ; preds = %1
store i32 0, i32* %2
br label %15
6: ; preds = %1
store i32 1, i32* %2
br label %15
7: ; preds = %1
store i32 2, i32* %2
br label %15
8: ; preds = %1
store i32 3, i32* %2
br label %15
9: ; preds = %1
store i32 4, i32* %2
br label %15
10: ; preds = %1
store i32 5, i32* %2
br label %15
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %10, %9, %8, %7, %6, %5
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"mkfs: unsupported block size.\0A\00"
define i32 @validate(i32 %0) {
switch i32 %0, label %7 [
i32 512, label %11
i32 1024, label %2
i32 2048, label %3
i32 4096, label %4
i32 8192, label %5
i32 16384, label %6
]
2: ; preds = %1
br label %11
3: ; preds = %1
br label %11
4: ; preds = %1
br label %11
5: ; preds = %1
br label %11
6: ; preds = %1
br label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %1, %6, %5, %4, %3, %2
%12 = phi i32 [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %2 ], [ 0, %1 ]
ret i32 %12
}