#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 strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
long strtoul(char *, int /*<<< orphan*/, int);
int cli_br_prio(int argc, char **argv) {
  long br_prio = 32768L;
  if (strlen(argv[1]) > 2 &&
      (!strncmp(argv[1], "0x", 2) || !strncmp(argv[1], "0X", 2))) {
    br_prio = strtoul(argv[1] + 2, 0, 16);
  } else {
    br_prio = strtoul(argv[1], 0, 10);
  }
  if (!br_prio) {
    printf("Warning: newPriority=0, are you sure ?\n");
  }
  set_bridge_cfg_value(br_prio, (1L << 1));
  return 0;
}


x86 assembly (clang, -O0):
<cli_br_prio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x8000,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jle    11e2 <cli_br_prio+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     11c1 <cli_br_prio+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe55(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11e2 <cli_br_prio+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x2,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <strtoul@plt>
mov    %rax,-0x18(%rbp)
jmp    11fa <cli_br_prio+0xaa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1211 <cli_br_prio+0xc1>
lea    0xdfa(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1060 <set_bridge_cfg_value@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_br_prio>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jl     1194 <cli_br_prio+0x44>
mov    0x8(%rbx),%rdi
lea    0xe93(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11a1 <cli_br_prio+0x51>
mov    0x8(%rbx),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11a1 <cli_br_prio+0x51>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
jmp    11b0 <cli_br_prio+0x60>
mov    0x8(%rbx),%rdi
add    $0x2,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <strtoul@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11c9 <cli_br_prio+0x79>
lea    0xe42(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%esi
mov    %rbx,%rdi
call   1060 <set_bridge_cfg_value@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"0x\00"
@.str.1 = [3 x i8] c"0X\00"
@.str.2 = [40 x i8] c"Warning: newPriority=0, are you sure ?\0A\00"
define i32 @cli_br_prio(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i64 32768, i64* %5
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strlen(i8* %8)
%10 = icmp sgt i32 %9, 2
br i1 %10, label %11, label %29
11: ; preds = %2
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strncmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strncmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%22 = icmp ne i32 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %17, %11
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8, i8* %26, i64 2
%28 = call i64 @strtoul(i8* %27, i32 0, i32 16)
store i64 %28, i64* %5
br label %34
29: ; preds = %17, %2
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i64 @strtoul(i8* %32, i32 0, i32 10)
store i64 %33, i64* %5
br label %34
34: ; preds = %29, %23
%35 = load i64, i64* %5
%36 = icmp ne i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = load i64, i64* %5
%41 = call i32 @set_bridge_cfg_value(i64 %40, i64 2)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"0x\00"
@.str.1 = [3 x i8] c"0X\00"
@str = [39 x i8] c"Warning: newPriority=0, are you sure ?\00"
define i32 @cli_br_prio(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strlen(i8* %4)
%6 = icmp sgt i32 %5, 2
br i1 %6, label %7, label %19
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = tail call i32 @strncmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = tail call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11, %7
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = tail call i64 @strtoul(i8* %17, i32 0, i32 16)
br label %22
19: ; preds = %11, %2
%20 = load i8*, i8** %3
%21 = tail call i64 @strtoul(i8* %20, i32 0, i32 10)
br label %22
22: ; preds = %19, %15
%23 = phi i64 [ %21, %19 ], [ %18, %15 ]
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = tail call i32 @set_bridge_cfg_value(i64 %23, i64 2)
ret i32 0
}