int aa_pro_ctr_a0b(int chan, unsigned char *buf, int len) {
  if (len != 4 || buf[2] != 0x08)
    hu_log(6, "hu_aap", __func__, "Ping Request");
  else
    hu_log(3, "hu_aap", __func__, "Ping Request: %d", buf[3]);
  buf[0] = 0;
  buf[1] = 12;
  int ret = hu_aap_enc_send(chan, buf, len);
  return (ret);
}


x86 assembly (clang, -O0):
<aa_pro_ctr_a0b>:
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    114d <aa_pro_ctr_a0b+0x2d>
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
cmp    $0x8,%eax
je     1173 <aa_pro_ctr_a0b+0x53>
mov    $0x6,%edi
lea    0xea7(%rip),%rsi
lea    0xea7(%rip),%rdx
lea    0xeaf(%rip),%rcx
mov    $0x0,%al
call   1030 <hu_log@plt>
jmp    119d <aa_pro_ctr_a0b+0x7d>
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    $0x3,%edi
lea    0xe78(%rip),%rsi
lea    0xe78(%rip),%rdx
lea    0xe8d(%rip),%rcx
mov    $0x0,%al
call   1030 <hu_log@plt>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movb   $0xc,0x1(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1040 <hu_aap_enc_send@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_pro_ctr_a0b>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%r14d
cmp    $0x4,%edx
jne    115f <aa_pro_ctr_a0b+0x3f>
cmpb   $0x8,0x2(%rbx)
jne    115f <aa_pro_ctr_a0b+0x3f>
movzbl 0x3(%rbx),%r8d
lea    0xebd(%rip),%rsi
lea    0xebd(%rip),%rdx
lea    0xed2(%rip),%rcx
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <hu_log@plt>
jmp    1180 <aa_pro_ctr_a0b+0x60>
lea    0xe9a(%rip),%rsi
lea    0xe9a(%rip),%rdx
lea    0xea2(%rip),%rcx
mov    $0x6,%edi
xor    %eax,%eax
call   1030 <hu_log@plt>
movw   $0xc00,(%rbx)
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <hu_aap_enc_send@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"hu_aap\00"
@__func__.aa_pro_ctr_a0b = [15 x i8] c"aa_pro_ctr_a0b\00"
@.str.1 = [13 x i8] c"Ping Request\00"
@.str.2 = [17 x i8] c"Ping Request: %d\00"
define i32 @aa_pro_ctr_a0b(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 4
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = icmp ne i32 %14, 8
br i1 %15, label %16, label %18
16: ; preds = %10, %3
%17 = 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_a0b, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %24
18: ; preds = %10
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 (i32, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, i32, ...)*)(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_a0b, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %18, %16
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i64 0
store i8 0, i8* %26
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8 12, i8* %28
%29 = load i32, i32* %4
%30 = load i8*, i8** %5
%31 = load i32, i32* %6
%32 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @hu_aap_enc_send to i32 (i32, i8*, i32, ...)*)(i32 %29, i8* %30, i32 %31)
store i32 %32, i32* %7
%33 = load i32, i32* %7
ret i32 %33
}

LLVM IR (-O2):
@.str = [7 x i8] c"hu_aap\00"
@__func__.aa_pro_ctr_a0b = [15 x i8] c"aa_pro_ctr_a0b\00"
@.str.1 = [13 x i8] c"Ping Request\00"
@.str.2 = [17 x i8] c"Ping Request: %d\00"
define i32 @aa_pro_ctr_a0b(i32 %0, i8* %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_a0b, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %1, i64 3
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = tail call i32 (i32, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, i32, ...)*)(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_a0b, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %11, %9
store i8 0, i8* %1
%17 = getelementptr inbounds i8, i8* %1, i64 1
store i8 12, i8* %17
%18 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @hu_aap_enc_send to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %1, i32 %2)
ret i32 %18
}