#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*/ printf(char *);
int setAdslSettings(unsigned short, char);
void cmdCfgAdslSetting(int cmdType, struct cmd_arg *pCmdArg) {
  unsigned short mode = 0;
  char olr = 0;
  int intVal;
  if (getArgValue(pCmdArg, "g.lite", (void *)&intVal) == 1) {
    mode |= 0x0008;
  }
  if (getArgValue(pCmdArg, "g.dmt", (void *)&intVal) == 1) {
    mode |= 0x0002;
  }
  if (getArgValue(pCmdArg, "t1.413", (void *)&intVal) == 1) {
    mode |= 0x0001;
  }
  if (getArgValue(pCmdArg, "adsl2", (void *)&intVal) == 1) {
    mode |= 0x0010;
  }
  if (getArgValue(pCmdArg, "adsl2+", (void *)&intVal) == 1) {
    mode |= 0x0040;
  }
  if (getArgValue(pCmdArg, "annexl", (void *)&intVal) == 1) {
    mode |= 0x0020;
  }
  if (getArgValue(pCmdArg, "annexm", (void *)&intVal) == 1) {
    mode |= 0x0080;
  }
  if (getArgValue(pCmdArg, "bitswap", (void *)&intVal) == 1) {
    olr |= 1;
  }
  if (getArgValue(pCmdArg, "sra", (void *)&intVal) == 1) {
    olr |= 2;
  }
  if (setAdslSettings(mode, olr) == -1) {
    printf("Set ADSL error!\n");
  }
}


x86 assembly (clang, -O0):
<cmdCfgAdslSetting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x0,-0x12(%rbp)
movb   $0x0,-0x13(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xea8(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    1171 <cmdCfgAdslSetting+0x41>
movzwl -0x12(%rbp),%eax
or     $0x8,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xe87(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    1199 <cmdCfgAdslSetting+0x69>
movzwl -0x12(%rbp),%eax
or     $0x2,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xe65(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    11c1 <cmdCfgAdslSetting+0x91>
movzwl -0x12(%rbp),%eax
or     $0x1,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xe44(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    11e9 <cmdCfgAdslSetting+0xb9>
movzwl -0x12(%rbp),%eax
or     $0x10,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xe22(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    1211 <cmdCfgAdslSetting+0xe1>
movzwl -0x12(%rbp),%eax
or     $0x40,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xe01(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    1239 <cmdCfgAdslSetting+0x109>
movzwl -0x12(%rbp),%eax
or     $0x20,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xde0(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    1263 <cmdCfgAdslSetting+0x133>
movzwl -0x12(%rbp),%eax
or     $0x80,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xdbd(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    128a <cmdCfgAdslSetting+0x15a>
movsbl -0x13(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x13(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xd9e(%rip),%rsi
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
jne    12b1 <cmdCfgAdslSetting+0x181>
movsbl -0x13(%rbp),%eax
or     $0x2,%eax
mov    %al,-0x13(%rbp)
mov    -0x12(%rbp),%ax
movzwl %ax,%edi
movsbl -0x13(%rbp),%esi
call   1040 <setAdslSettings@plt>
cmp    $0xffffffff,%eax
jne    12d6 <cmdCfgAdslSetting+0x1a6>
lea    0xd6a(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdCfgAdslSetting>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r12
lea    0xeba(%rip),%rsi
lea    0xc(%rsp),%r14
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
xor    %ebp,%ebp
cmp    $0x1,%eax
sete   %bpl
lea    0x0(,%rbp,8),%r15d
lea    0xe99(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
lea    0x2(,%rbp,8),%ebp
cmovne %r15d,%ebp
lea    0xe7f(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
lea    (%rbx,%rbp,1),%r15d
lea    0xe68(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
cmp    $0x1,%eax
lea    0x10(%rbp,%rbx,1),%ebx
cmovne %r15d,%ebx
lea    0xe51(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
mov    %ebx,%ebp
or     $0x40,%ebp
cmp    $0x1,%eax
cmovne %ebx,%ebp
lea    0xe3b(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
mov    %ebp,%ebx
or     $0x20,%ebx
cmp    $0x1,%eax
cmovne %ebp,%ebx
lea    0xe25(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
mov    %ebx,%ebp
or     $0x80,%ebp
cmp    $0x1,%eax
cmovne %ebx,%ebp
lea    0xe0c(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
lea    0xdfa(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1050 <getArgValue@plt>
lea    0x2(%rbx),%ecx
cmp    $0x1,%eax
movzbl %cl,%eax
cmovne %ebx,%eax
movzwl %bp,%edi
movzbl %al,%esi
call   1040 <setAdslSettings@plt>
cmp    $0xffffffff,%eax
jne    1270 <cmdCfgAdslSetting+0x140>
lea    0xdd0(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.cmd_arg = type { i32 }
@.str = [7 x i8] c"g.lite\00"
@.str.1 = [6 x i8] c"g.dmt\00"
@.str.2 = [7 x i8] c"t1.413\00"
@.str.3 = [6 x i8] c"adsl2\00"
@.str.4 = [7 x i8] c"adsl2+\00"
@.str.5 = [7 x i8] c"annexl\00"
@.str.6 = [7 x i8] c"annexm\00"
@.str.7 = [8 x i8] c"bitswap\00"
@.str.8 = [4 x i8] c"sra\00"
@.str.9 = [17 x i8] c"Set ADSL error!\0A\00"
define void @cmdCfgAdslSetting(i32 %0, %struct.cmd_arg* %1) {
%3 = alloca i32
%4 = alloca %struct.cmd_arg*
%5 = alloca i16
%6 = alloca i8
%7 = alloca i32
store i32 %0, i32* %3
store %struct.cmd_arg* %1, %struct.cmd_arg** %4
store i16 0, i16* %5
store i8 0, i8* %6
%8 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%9 = bitcast i32* %7 to i8*
%10 = call i32 @getArgValue(%struct.cmd_arg* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i16, i16* %5
%14 = zext i16 %13 to i32
%15 = or i32 %14, 8
%16 = trunc i32 %15 to i16
store i16 %16, i16* %5
br label %17
17: ; preds = %12, %2
%18 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%19 = bitcast i32* %7 to i8*
%20 = call i32 @getArgValue(%struct.cmd_arg* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load i16, i16* %5
%24 = zext i16 %23 to i32
%25 = or i32 %24, 2
%26 = trunc i32 %25 to i16
store i16 %26, i16* %5
br label %27
27: ; preds = %22, %17
%28 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%29 = bitcast i32* %7 to i8*
%30 = call i32 @getArgValue(%struct.cmd_arg* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %37
32: ; preds = %27
%33 = load i16, i16* %5
%34 = zext i16 %33 to i32
%35 = or i32 %34, 1
%36 = trunc i32 %35 to i16
store i16 %36, i16* %5
br label %37
37: ; preds = %32, %27
%38 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%39 = bitcast i32* %7 to i8*
%40 = call i32 @getArgValue(%struct.cmd_arg* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %39)
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %47
42: ; preds = %37
%43 = load i16, i16* %5
%44 = zext i16 %43 to i32
%45 = or i32 %44, 16
%46 = trunc i32 %45 to i16
store i16 %46, i16* %5
br label %47
47: ; preds = %42, %37
%48 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%49 = bitcast i32* %7 to i8*
%50 = call i32 @getArgValue(%struct.cmd_arg* %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %57
52: ; preds = %47
%53 = load i16, i16* %5
%54 = zext i16 %53 to i32
%55 = or i32 %54, 64
%56 = trunc i32 %55 to i16
store i16 %56, i16* %5
br label %57
57: ; preds = %52, %47
%58 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%59 = bitcast i32* %7 to i8*
%60 = call i32 @getArgValue(%struct.cmd_arg* %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %59)
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %67
62: ; preds = %57
%63 = load i16, i16* %5
%64 = zext i16 %63 to i32
%65 = or i32 %64, 32
%66 = trunc i32 %65 to i16
store i16 %66, i16* %5
br label %67
67: ; preds = %62, %57
%68 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%69 = bitcast i32* %7 to i8*
%70 = call i32 @getArgValue(%struct.cmd_arg* %68, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %69)
%71 = icmp eq i32 %70, 1
br i1 %71, label %72, label %77
72: ; preds = %67
%73 = load i16, i16* %5
%74 = zext i16 %73 to i32
%75 = or i32 %74, 128
%76 = trunc i32 %75 to i16
store i16 %76, i16* %5
br label %77
77: ; preds = %72, %67
%78 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%79 = bitcast i32* %7 to i8*
%80 = call i32 @getArgValue(%struct.cmd_arg* %78, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %79)
%81 = icmp eq i32 %80, 1
br i1 %81, label %82, label %87
82: ; preds = %77
%83 = load i8, i8* %6
%84 = sext i8 %83 to i32
%85 = or i32 %84, 1
%86 = trunc i32 %85 to i8
store i8 %86, i8* %6
br label %87
87: ; preds = %82, %77
%88 = load %struct.cmd_arg*, %struct.cmd_arg** %4
%89 = bitcast i32* %7 to i8*
%90 = call i32 @getArgValue(%struct.cmd_arg* %88, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %89)
%91 = icmp eq i32 %90, 1
br i1 %91, label %92, label %97
92: ; preds = %87
%93 = load i8, i8* %6
%94 = sext i8 %93 to i32
%95 = or i32 %94, 2
%96 = trunc i32 %95 to i8
store i8 %96, i8* %6
br label %97
97: ; preds = %92, %87
%98 = load i16, i16* %5
%99 = load i8, i8* %6
%100 = call i32 @setAdslSettings(i16 zeroext %98, i8 signext %99)
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %104
102: ; preds = %97
%103 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
br label %104
104: ; preds = %102, %97
ret void
}

LLVM IR (-O2):
%struct.cmd_arg = type { i32 }
@.str = [7 x i8] c"g.lite\00"
@.str.1 = [6 x i8] c"g.dmt\00"
@.str.2 = [7 x i8] c"t1.413\00"
@.str.3 = [6 x i8] c"adsl2\00"
@.str.4 = [7 x i8] c"adsl2+\00"
@.str.5 = [7 x i8] c"annexl\00"
@.str.6 = [7 x i8] c"annexm\00"
@.str.7 = [8 x i8] c"bitswap\00"
@.str.8 = [4 x i8] c"sra\00"
@str = [16 x i8] c"Set ADSL error!\00"
define void @cmdCfgAdslSetting(i32 %0, %struct.cmd_arg* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i16 8, i16 0
%8 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%9 = icmp eq i32 %8, 1
%10 = or i16 %7, 2
%11 = select i1 %9, i16 %10, i16 %7
%12 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i16
%15 = or i16 %11, %14
%16 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%17 = icmp eq i32 %16, 1
%18 = or i16 %15, 16
%19 = select i1 %17, i16 %18, i16 %15
%20 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%21 = icmp eq i32 %20, 1
%22 = or i16 %19, 64
%23 = select i1 %21, i16 %22, i16 %19
%24 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%25 = icmp eq i32 %24, 1
%26 = or i16 %23, 32
%27 = select i1 %25, i16 %26, i16 %23
%28 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%29 = icmp eq i32 %28, 1
%30 = or i16 %27, 128
%31 = select i1 %29, i16 %30, i16 %27
%32 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %4)
%33 = icmp eq i32 %32, 1
%34 = zext i1 %33 to i8
%35 = call i32 @getArgValue(%struct.cmd_arg* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%36 = icmp eq i32 %35, 1
%37 = or i8 %34, 2
%38 = select i1 %36, i8 %37, i8 %34
%39 = call i32 @setAdslSettings(i16 zeroext %31, i8 signext %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %2
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %43
43: ; preds = %41, %2
ret void
}