#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 */
struct cmd_arg {
  int dummy;
};

/* Variables and functions */
int getArgValue(struct cmd_arg *, char *, void *);
int /*<<< orphan*/ setBridgeAgingTime(unsigned short);
int /*<<< orphan*/ setBridgeStp(unsigned char);
int /*<<< orphan*/ strcasecmp(char *, unsigned char *);
void cmdSetBridging(int cmdType, struct cmd_arg *pCmdArg) {
  unsigned char enabled;
  unsigned short time;
  unsigned int aging;
  unsigned char buf[32];
  if (getArgValue(pCmdArg, "aging", (void *)&aging) == 1) {
    time = aging;
    setBridgeAgingTime(time);
  }
  if (getArgValue(pCmdArg, "stp", (void *)buf) == 1) {
    if (!strcasecmp("on", buf))
      enabled = 1;
    else
      enabled = 0;
    setBridgeStp(enabled);
  }
}


x86 assembly (clang, -O0):
<cmdSetBridging>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xea2(%rip),%rsi
call   1060 <getArgValue@plt>
cmp    $0x1,%eax
jne    117c <cmdSetBridging+0x3c>
mov    -0x18(%rbp),%eax
mov    %ax,-0x14(%rbp)
movzwl -0x14(%rbp),%edi
call   1030 <setBridgeAgingTime@plt>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    0xe7b(%rip),%rsi
call   1060 <getArgValue@plt>
cmp    $0x1,%eax
jne    11c8 <cmdSetBridging+0x88>
lea    -0x40(%rbp),%rsi
lea    0xe66(%rip),%rdi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11bb <cmdSetBridging+0x7b>
movb   $0x1,-0x11(%rbp)
jmp    11bf <cmdSetBridging+0x7f>
movb   $0x0,-0x11(%rbp)
movzbl -0x11(%rbp),%edi
call   1050 <setBridgeStp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdSetBridging>:
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
lea    0xeb1(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <getArgValue@plt>
cmp    $0x1,%eax
jne    116b <cmdSetBridging+0x2b>
movzwl 0xc(%rsp),%edi
call   1030 <setBridgeAgingTime@plt>
lea    0xe94(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <getArgValue@plt>
cmp    $0x1,%eax
jne    11a2 <cmdSetBridging+0x62>
lea    0xe7f(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <strcasecmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <setBridgeStp@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.cmd_arg = type { i32 }
@.str = [6 x i8] c"aging\00"
@.str.1 = [4 x i8] c"stp\00"
@.str.2 = [3 x i8] c"on\00"
define void @cmdSetBridging(i32 %0, %struct.cmd_arg* %1) {
%3 = alloca i32
%4 = alloca %struct.cmd_arg*
%5 = alloca i8
%6 = alloca i16
%7 = alloca i32
%8 = alloca [32 x i8]
store i32 %0, i32* %3
store %struct.cmd_arg* %1, %struct.cmd_arg** %4
%9 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%10 = bitcast i32* %7 to i8*
%11 = call i32 @getArgValue(%struct.cmd_arg* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i32, i32* %7
%15 = trunc i32 %14 to i16
store i16 %15, i16* %6
%16 = load i16, i16* %6
%17 = call i32 @setBridgeAgingTime(i16 zeroext %16)
br label %18
18: ; preds = %13, %2
%19 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%21 = call i32 @getArgValue(%struct.cmd_arg* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %32
23: ; preds = %18
%24 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%25 = call i32 @strcasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %23
store i8 1, i8* %5
br label %29
28: ; preds = %23
store i8 0, i8* %5
br label %29
29: ; preds = %28, %27
%30 = load i8, i8* %5
%31 = call i32 @setBridgeStp(i8 zeroext %30)
br label %32
32: ; preds = %29, %18
ret void
}

LLVM IR (-O2):
%struct.cmd_arg = type { i32 }
@.str = [6 x i8] c"aging\00"
@.str.1 = [4 x i8] c"stp\00"
@.str.2 = [3 x i8] c"on\00"
define void @cmdSetBridging(i32 %0, %struct.cmd_arg* %1) {
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%7 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %3
%11 = trunc i32 %10 to i16
%12 = call i32 @setBridgeAgingTime(i16 zeroext %11)
br label %13
13: ; preds = %9, %2
%14 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = call i32 @strcasecmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i8
%20 = call i32 @setBridgeStp(i8 zeroext %19)
br label %21
21: ; preds = %16, %13
ret void
}