#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 */
scalar_t__ get_bool_arg(int, int, char **, unsigned long *);
int /*<<< orphan*/ set_rstp_port_cfg_value(int, unsigned long, long);
int strtoul(char *, int /*<<< orphan*/, int);
int cli_prt_edge(int argc, char **argv) {
  int port_index = 0;
  unsigned long value = 1;
  if ('a' != argv[1][0]) {
    port_index = strtoul(argv[1], 0, 10);
  }
  if (0 != get_bool_arg(2, argc, argv, &value)) {
    return 0;
  }
  set_rstp_port_cfg_value(port_index, value, (1L << 4));
  return 0;
}


x86 assembly (clang, -O0):
<cli_prt_edge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
je     117d <cli_prt_edge+0x4d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x2,%edi
lea    -0x20(%rbp),%rcx
call   1040 <get_bool_arg@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11ac <cli_prt_edge+0x7c>
movl   $0x0,-0x4(%rbp)
jmp    11c4 <cli_prt_edge+0x94>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1030 <set_rstp_port_cfg_value@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_prt_edge>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movq   $0x1,0x8(%rsp)
mov    0x8(%rsi),%rdi
xor    %r14d,%r14d
cmpb   $0x61,(%rdi)
je     1161 <cli_prt_edge+0x31>
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %eax,%r14d
lea    0x8(%rsp),%rcx
mov    $0x2,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1040 <get_bool_arg@plt>
test   %rax,%rax
jne    118c <cli_prt_edge+0x5c>
mov    0x8(%rsp),%rsi
mov    $0x10,%edx
mov    %r14d,%edi
call   1030 <set_rstp_port_cfg_value@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cli_prt_edge(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i64 1, i64* %7
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 97, %13
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strtoul(i8* %18, i32 0, i32 10)
store i32 %19, i32* %6
br label %20
20: ; preds = %15, %2
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i64 @get_bool_arg(i32 2, i32 %21, i8** %22, i64* %7)
%24 = icmp ne i64 0, %23
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 0, i32* %3
br label %30
26: ; preds = %20
%27 = load i32, i32* %6
%28 = load i64, i64* %7
%29 = call i32 @set_rstp_port_cfg_value(i32 %27, i64 %28, i64 16)
store i32 0, i32* %3
br label %30
30: ; preds = %26, %25
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @cli_prt_edge(i32 %0, i8** %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 1, i64* %3
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 97
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = tail call i32 @strtoul(i8* %6, i32 0, i32 10)
br label %11
11: ; preds = %9, %2
%12 = phi i32 [ %10, %9 ], [ 0, %2 ]
%13 = call i64 @get_bool_arg(i32 2, i32 %0, i8** %1, i64* %3)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i64, i64* %3
%17 = call i32 @set_rstp_port_cfg_value(i32 %12, i64 %16, i64 16)
br label %18
18: ; preds = %11, %15
ret i32 0
}