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


x86 assembly (clang, -O0):
<cli_prt_pcost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
je     116d <cli_prt_pcost+0x4d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x2,%edx
call   1030 <set_rstp_port_cfg_value@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_prt_pcost>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %r14d,%r14d
cmpb   $0x61,(%rdi)
je     1142 <cli_prt_pcost+0x22>
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    $0x2,%edx
mov    %r14d,%edi
mov    %rax,%rsi
call   1030 <set_rstp_port_cfg_value@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @cli_prt_pcost(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
store i64 0, i64* %6
%7 = load i8**, i8*** %4
%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
%13 = icmp ne i32 97, %12
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i8* @strtoul(i8* %17, i32 0, i32 10)
%19 = ptrtoint i8* %18 to i32
store i32 %19, i32* %5
br label %20
20: ; preds = %14, %2
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i8* @strtoul(i8* %23, i32 0, i32 10)
%25 = ptrtoint i8* %24 to i64
store i64 %25, i64* %6
%26 = load i32, i32* %5
%27 = load i64, i64* %6
%28 = call i32 @set_rstp_port_cfg_value(i32 %26, i64 %27, i64 2)
ret i32 0
}

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