int aa_pro_ctr_a11(int chan, unsigned char *buf, int len) {
  if (len != 4 || buf[2] != 0x08)
    hu_log(6, "hu_aap", __func__, "Voice Session Notification");
  else if (buf[3] == 1)
    hu_log(3, "hu_aap", __func__, "Voice Session Notification: 1 START");
  else if (buf[3] == 2)
    hu_log(3, "hu_aap", __func__, "Voice Session Notification: 2 STOP");
  else
    hu_log(6, "hu_aap", __func__, "Voice Session Notification: %d", buf[3]);
  return (0);
}


x86 assembly (clang, -O0):
<aa_pro_ctr_a11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jne    113d <aa_pro_ctr_a11+0x2d>
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
cmp    $0x8,%eax
je     1163 <aa_pro_ctr_a11+0x53>
mov    $0x6,%edi
lea    0xeb7(%rip),%rsi
lea    0xeb7(%rip),%rdx
lea    0xebf(%rip),%rcx
mov    $0x0,%al
call   1030 <hu_log@plt>
jmp    1205 <aa_pro_ctr_a11+0xf5>
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x1,%eax
jne    119a <aa_pro_ctr_a11+0x8a>
mov    $0x3,%edi
lea    0xe80(%rip),%rsi
lea    0xe80(%rip),%rdx
lea    0xea3(%rip),%rcx
mov    $0x0,%al
call   1030 <hu_log@plt>
jmp    1200 <aa_pro_ctr_a11+0xf0>
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x2,%eax
jne    11d1 <aa_pro_ctr_a11+0xc1>
mov    $0x3,%edi
lea    0xe49(%rip),%rsi
lea    0xe49(%rip),%rdx
lea    0xe90(%rip),%rcx
mov    $0x0,%al
call   1030 <hu_log@plt>
jmp    11fb <aa_pro_ctr_a11+0xeb>
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    $0x6,%edi
lea    0xe1a(%rip),%rsi
lea    0xe1a(%rip),%rdx
lea    0xe84(%rip),%rcx
mov    $0x0,%al
call   1030 <hu_log@plt>
jmp    1200 <aa_pro_ctr_a11+0xf0>
jmp    1205 <aa_pro_ctr_a11+0xf5>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_pro_ctr_a11>:
push   %rax
cmp    $0x4,%edx
jne    1144 <aa_pro_ctr_a11+0x34>
cmpb   $0x8,0x2(%rsi)
jne    1144 <aa_pro_ctr_a11+0x34>
movzbl 0x3(%rsi),%r8d
lea    0xed8(%rip),%rsi
lea    0xed8(%rip),%rdx
cmp    $0x2,%r8d
je     1169 <aa_pro_ctr_a11+0x59>
cmp    $0x1,%r8b
jne    1177 <aa_pro_ctr_a11+0x67>
lea    0xeef(%rip),%rcx
jmp    1170 <aa_pro_ctr_a11+0x60>
lea    0xeb5(%rip),%rsi
lea    0xeb5(%rip),%rdx
lea    0xebd(%rip),%rcx
mov    $0x6,%edi
xor    %eax,%eax
call   1030 <hu_log@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xee5(%rip),%rcx
mov    $0x3,%edi
jmp    115e <aa_pro_ctr_a11+0x4e>
lea    0xefa(%rip),%rcx
mov    $0x6,%edi
xor    %eax,%eax
call   1030 <hu_log@plt>
jmp    1165 <aa_pro_ctr_a11+0x55>

LLVM IR (-O0):
@.str = [7 x i8] c"hu_aap\00"
@__func__.aa_pro_ctr_a11 = [15 x i8] c"aa_pro_ctr_a11\00"
@.str.1 = [27 x i8] c"Voice Session Notification\00"
@.str.2 = [36 x i8] c"Voice Session Notification: 1 START\00"
@.str.3 = [35 x i8] c"Voice Session Notification: 2 STOP\00"
@.str.4 = [31 x i8] c"Voice Session Notification: %d\00"
define i32 @aa_pro_ctr_a11(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 4
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp ne i32 %13, 8
br i1 %14, label %15, label %17
15: ; preds = %9, %3
%16 = call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %41
17: ; preds = %9
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 3
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %40
25: ; preds = %17
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 3
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = icmp eq i32 %29, 2
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %39
33: ; preds = %25
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 3
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = call i32 (i32, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, i32, ...)*)(i32 6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %33, %31
br label %40
40: ; preds = %39, %23
br label %41
41: ; preds = %40, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"hu_aap\00"
@__func__.aa_pro_ctr_a11 = [15 x i8] c"aa_pro_ctr_a11\00"
@.str.1 = [27 x i8] c"Voice Session Notification\00"
@.str.2 = [36 x i8] c"Voice Session Notification: 1 START\00"
@.str.3 = [35 x i8] c"Voice Session Notification: 2 STOP\00"
@.str.4 = [31 x i8] c"Voice Session Notification: %d\00"
define i32 @aa_pro_ctr_a11(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 4
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = getelementptr inbounds i8, i8* %1, i64 2
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 8
br i1 %8, label %11, label %9
9: ; preds = %5, %3
%10 = tail call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %21
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %1, i64 3
%13 = load i8, i8* %12
switch i8 %13, label %18 [
i8 1, label %14
i8 2, label %16
]
14: ; preds = %11
%15 = tail call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %21
16: ; preds = %11
%17 = tail call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %21
18: ; preds = %11
%19 = zext i8 %13 to i32
%20 = tail call i32 (i32, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, i32, ...)*)(i32 6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.aa_pro_ctr_a11, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %14, %18, %16, %9
ret i32 0
}