#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*/ printf(char *, ...);
int /*<<< orphan*/ set_bridge_cfg_value(long, long);
int cli_br_fvers(int argc, char **argv) {
  long value = 2L;
  switch (argv[1][0]) {
  case '0':
  case '1':
  case 'f':
  case 'F':
    value = 0L;
    printf("Accepted 'force_slow'\n");
    break;
  case '2':
  case 'r':
  case 'R':
    printf("Accepted 'rapid'\n");
    value = 2L;
    break;
  default:
    printf("Invalid argument '%s'\n", argv[1]);
    return 0;
  }
  set_bridge_cfg_value(value, (1L << 5));
  return 0;
}


x86 assembly (clang, -O0):
<cli_br_fvers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x2,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x42,%eax
ja     119e <cli_br_fvers+0x7e>
mov    -0x20(%rbp),%rax
lea    0xea1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x0,-0x18(%rbp)
lea    0xf95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c0 <cli_br_fvers+0xa0>
lea    0xf99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x2,-0x18(%rbp)
jmp    11c0 <cli_br_fvers+0xa0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xf88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d5 <cli_br_fvers+0xb5>
mov    -0x18(%rbp),%rdi
mov    $0x20,%esi
call   1040 <set_bridge_cfg_value@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_br_fvers>:
push   %rbx
mov    0x8(%rsi),%rsi
movsbl (%rsi),%eax
add    $0xffffffd0,%eax
cmp    $0x42,%eax
ja     117b <cli_br_fvers+0x4b>
lea    0xfed(%rip),%rdi
xor    %ebx,%ebx
lea    0xeb0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x2,%ebx
lea    0xfbe(%rip),%rdi
call   1030 <puts@plt>
mov    $0x20,%esi
mov    %rbx,%rdi
call   1050 <set_bridge_cfg_value@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xf8a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1177 <cli_br_fvers+0x47>

LLVM IR (-O0):
@.str = [23 x i8] c"Accepted 'force_slow'\0A\00"
@.str.1 = [18 x i8] c"Accepted 'rapid'\0A\00"
@.str.2 = [23 x i8] c"Invalid argument '%s'\0A\00"
define i32 @cli_br_fvers(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 2, i64* %6
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %17 [
i32 48, label %13
i32 49, label %13
i32 102, label %13
i32 70, label %13
i32 50, label %15
i32 114, label %15
i32 82, label %15
]
13: ; preds = %2, %2, %2, %2
store i64 0, i64* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %22
15: ; preds = %2, %2, %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
store i64 2, i64* %6
br label %22
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %20)
store i32 0, i32* %3
br label %25
22: ; preds = %15, %13
%23 = load i64, i64* %6
%24 = call i32 @set_bridge_cfg_value(i64 %23, i64 32)
store i32 0, i32* %3
br label %25
25: ; preds = %22, %17
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str.2 = [23 x i8] c"Invalid argument '%s'\0A\00"
@str = [17 x i8] c"Accepted 'rapid'\00"
@str.3 = [22 x i8] c"Accepted 'force_slow'\00"
define i32 @cli_br_fvers(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %8 [
i32 48, label %10
i32 49, label %10
i32 102, label %10
i32 70, label %10
i32 50, label %7
i32 114, label %7
i32 82, label %7
]
7: ; preds = %2, %2, %2
br label %10
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %15
10: ; preds = %2, %2, %2, %2, %7
%11 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0), %7 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0), %2 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0), %2 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0), %2 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0), %2 ]
%12 = phi i64 [ 2, %7 ], [ 0, %2 ], [ 0, %2 ], [ 0, %2 ], [ 0, %2 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %11)
%14 = tail call i32 @set_bridge_cfg_value(i64 %12, i64 32)
br label %15
15: ; preds = %10, %8
ret i32 0
}