#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*/ _verbprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ aprs_print_ax25call(unsigned char *, int);
void aprs_disp_packet(unsigned char *bp, unsigned int len) {
  unsigned char *hdr = bp + 14;
  unsigned int hlen = len - 14;
  while ((!(hdr[-1] & 1)) && (hlen >= 7)) {
    hdr += 7;
    hlen -= 7;
  }
  if (*hdr++ != 0x03)
    return;
  if (*hdr++ != 0xf0)
    return;
  do {
    if (0 <= 0)
      _verbprintf(0, "APRS: ");
  } while (0);
  aprs_print_ax25call(&bp[7], 0);
  do {
    if (0 <= 0)
      _verbprintf(0, ">");
  } while (0);
  aprs_print_ax25call(&bp[0], 0);
  bp += 14;
  len -= 14;
  while ((!(bp[-1] & 1)) && (len >= 7)) {
    if ((!(bp[-1] & 1)) && (len >= 7))
      do {
        if (0 <= 0)
          _verbprintf(0, ",");
      } while (0);
    aprs_print_ax25call(&bp[0], 1);
    bp += 7;
    len -= 7;
  }
  do {
    if (0 <= 0)
      _verbprintf(0, ":");
  } while (0);
  bp += 2;
  len -= 2;
  if (!len)
    return;
  while (len) {
    do {
      if (0 <= 0)
        _verbprintf(0, "%c", *bp++);
    } while (0);
    len--;
  }
  do {
    if (0 <= 0)
      _verbprintf(0, "\n");
  } while (0);
}


x86 assembly (clang, -O0):
<aprs_disp_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0xe,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    $0xe,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movzbl -0x1(%rax),%ecx
and    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
jne    1167 <aprs_disp_packet+0x47>
cmpl   $0x7,-0x1c(%rbp)
setae  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1177 <aprs_disp_packet+0x57>
jmp    1191 <aprs_disp_packet+0x71>
mov    -0x18(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x1c(%rbp)
jmp    1144 <aprs_disp_packet+0x24>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%eax
cmp    $0x3,%eax
je     11b1 <aprs_disp_packet+0x91>
jmp    134c <aprs_disp_packet+0x22c>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%eax
cmp    $0xf0,%eax
je     11d3 <aprs_disp_packet+0xb3>
jmp    134c <aprs_disp_packet+0x22c>
jmp    11d8 <aprs_disp_packet+0xb8>
xor    %edi,%edi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1040 <_verbprintf@plt>
mov    -0x8(%rbp),%rdi
add    $0x7,%rdi
xor    %esi,%esi
call   1030 <aprs_print_ax25call@plt>
xor    %edi,%edi
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1040 <_verbprintf@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <aprs_print_ax25call@plt>
mov    -0x8(%rbp),%rax
add    $0xe,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0xe,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl -0x1(%rax),%ecx
and    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1e(%rbp)
jne    124a <aprs_disp_packet+0x12a>
cmpl   $0x7,-0xc(%rbp)
setae  %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
test   $0x1,%al
jne    125a <aprs_disp_packet+0x13a>
jmp    12ba <aprs_disp_packet+0x19a>
mov    -0x8(%rbp),%rax
movzbl -0x1(%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1292 <aprs_disp_packet+0x172>
cmpl   $0x7,-0xc(%rbp)
jb     1292 <aprs_disp_packet+0x172>
jmp    127d <aprs_disp_packet+0x15d>
xor    %edi,%edi
lea    0xd83(%rip),%rsi
mov    $0x0,%al
call   1040 <_verbprintf@plt>
jmp    1292 <aprs_disp_packet+0x172>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <aprs_print_ax25call@plt>
mov    -0x8(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0xc(%rbp)
jmp    1227 <aprs_disp_packet+0x107>
jmp    12bf <aprs_disp_packet+0x19f>
xor    %edi,%edi
lea    0xd43(%rip),%rsi
mov    $0x0,%al
call   1040 <_verbprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    12f3 <aprs_disp_packet+0x1d3>
jmp    134c <aprs_disp_packet+0x22c>
jmp    12f8 <aprs_disp_packet+0x1d8>
cmpl   $0x0,-0xc(%rbp)
je     1337 <aprs_disp_packet+0x217>
jmp    1307 <aprs_disp_packet+0x1e7>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edx
xor    %edi,%edi
lea    0xceb(%rip),%rsi
mov    $0x0,%al
call   1040 <_verbprintf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    12f8 <aprs_disp_packet+0x1d8>
jmp    133c <aprs_disp_packet+0x21c>
xor    %edi,%edi
lea    0xccb(%rip),%rsi
mov    $0x0,%al
call   1040 <_verbprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aprs_disp_packet>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0xe(%rdi),%r12
lea    -0xe(%r15),%ebp
testb  $0x1,0xd(%rdi)
mov    %r12,%rax
jne    1164 <aprs_disp_packet+0x44>
mov    %r12,%rax
cmp    $0x7,%ebp
jb     1164 <aprs_disp_packet+0x44>
lea    -0x15(%r15),%ecx
mov    %r12,%rax
xchg   %ax,%ax
testb  $0x1,0x6(%rax)
lea    0x7(%rax),%rax
jne    1164 <aprs_disp_packet+0x44>
lea    -0x7(%rcx),%edx
cmp    $0x6,%ecx
mov    %edx,%ecx
ja     1150 <aprs_disp_packet+0x30>
cmpb   $0x3,(%rax)
jne    1261 <aprs_disp_packet+0x141>
cmpb   $0xf0,0x1(%rax)
jne    1261 <aprs_disp_packet+0x141>
lea    0xe82(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1040 <_verbprintf@plt>
lea    0x7(%r14),%rdi
xor    %esi,%esi
call   1030 <aprs_print_ax25call@plt>
lea    0xe6e(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1040 <_verbprintf@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <aprs_print_ax25call@plt>
testb  $0x1,0xd(%r14)
jne    1206 <aprs_disp_packet+0xe6>
cmp    $0x7,%ebp
jb     1206 <aprs_disp_packet+0xe6>
add    $0xffffffeb,%r15d
lea    0xe46(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rbx
xor    %edi,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <_verbprintf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
call   1030 <aprs_print_ax25call@plt>
add    $0x7,%r12
lea    -0x7(%r15),%ebp
testb  $0x1,0x6(%rbx)
jne    1203 <aprs_disp_packet+0xe3>
cmp    $0x6,%r15d
mov    %ebp,%r15d
ja     11d0 <aprs_disp_packet+0xb0>
add    $0x7,%ebp
lea    0xdfe(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1040 <_verbprintf@plt>
cmp    $0x2,%ebp
je     1261 <aprs_disp_packet+0x141>
mov    %ebp,%ebp
mov    $0x2,%ebx
lea    0xde4(%rip),%r14
nopl   0x0(%rax)
movzbl (%r12,%rbx,1),%edx
xor    %edi,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <_verbprintf@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1230 <aprs_disp_packet+0x110>
lea    0xdc0(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <_verbprintf@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"APRS: \00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [2 x i8] c":\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @aprs_disp_packet(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 14
store i8* %8, i8** %5
%9 = load i32, i32* %4
%10 = sub i32 %9, 14
store i32 %10, i32* %6
br label %11
11: ; preds = %23, %2
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i64 -1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = and i32 %15, 1
%17 = icmp ne i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = icmp uge i32 %19, 7
br label %21
21: ; preds = %18, %11
%22 = phi i1 [ false, %11 ], [ %20, %18 ]
br i1 %22, label %23, label %28
23: ; preds = %21
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i64 7
store i8* %25, i8** %5
%26 = load i32, i32* %6
%27 = sub i32 %26, 7
store i32 %27, i32* %6
br label %11
28: ; preds = %21
%29 = load i8*, i8** %5
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %5
%31 = load i8, i8* %29
%32 = zext i8 %31 to i32
%33 = icmp ne i32 %32, 3
br i1 %33, label %34, label %35
34: ; preds = %28
br label %121
35: ; preds = %28
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %5
%38 = load i8, i8* %36
%39 = zext i8 %38 to i32
%40 = icmp ne i32 %39, 240
br i1 %40, label %41, label %42
41: ; preds = %35
br label %121
42: ; preds = %35
br label %43
43: ; preds = %42
%44 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %45
45: ; preds = %43
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i64 7
%48 = call i32 @aprs_print_ax25call(i8* %47, i32 0)
br label %49
49: ; preds = %45
%50 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %51
51: ; preds = %49
%52 = load i8*, i8** %3
%53 = getelementptr inbounds i8, i8* %52, i64 0
%54 = call i32 @aprs_print_ax25call(i8* %53, i32 0)
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i64 14
store i8* %56, i8** %3
%57 = load i32, i32* %4
%58 = sub i32 %57, 14
store i32 %58, i32* %4
br label %59
59: ; preds = %85, %51
%60 = load i8*, i8** %3
%61 = getelementptr inbounds i8, i8* %60, i64 -1
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = and i32 %63, 1
%65 = icmp ne i32 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %59
%67 = load i32, i32* %4
%68 = icmp uge i32 %67, 7
br label %69
69: ; preds = %66, %59
%70 = phi i1 [ false, %59 ], [ %68, %66 ]
br i1 %70, label %71, label %93
71: ; preds = %69
%72 = load i8*, i8** %3
%73 = getelementptr inbounds i8, i8* %72, i64 -1
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
%76 = and i32 %75, 1
%77 = icmp ne i32 %76, 0
br i1 %77, label %85, label %78
78: ; preds = %71
%79 = load i32, i32* %4
%80 = icmp uge i32 %79, 7
br i1 %80, label %81, label %85
81: ; preds = %78
br label %82
82: ; preds = %81
%83 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %84
84: ; preds = %82
br label %85
85: ; preds = %84, %78, %71
%86 = load i8*, i8** %3
%87 = getelementptr inbounds i8, i8* %86, i64 0
%88 = call i32 @aprs_print_ax25call(i8* %87, i32 1)
%89 = load i8*, i8** %3
%90 = getelementptr inbounds i8, i8* %89, i64 7
store i8* %90, i8** %3
%91 = load i32, i32* %4
%92 = sub i32 %91, 7
store i32 %92, i32* %4
br label %59
93: ; preds = %69
br label %94
94: ; preds = %93
%95 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %96
96: ; preds = %94
%97 = load i8*, i8** %3
%98 = getelementptr inbounds i8, i8* %97, i64 2
store i8* %98, i8** %3
%99 = load i32, i32* %4
%100 = sub i32 %99, 2
store i32 %100, i32* %4
%101 = load i32, i32* %4
%102 = icmp ne i32 %101, 0
br i1 %102, label %104, label %103
103: ; preds = %96
br label %121
104: ; preds = %96
br label %105
105: ; preds = %115, %104
%106 = load i32, i32* %4
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %118
108: ; preds = %105
br label %109
109: ; preds = %108
%110 = load i8*, i8** %3
%111 = getelementptr inbounds i8, i8* %110, i32 1
store i8* %111, i8** %3
%112 = load i8, i8* %110
%113 = zext i8 %112 to i32
%114 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %113)
br label %115
115: ; preds = %109
%116 = load i32, i32* %4
%117 = add i32 %116, -1
store i32 %117, i32* %4
br label %105
118: ; preds = %105
br label %119
119: ; preds = %118
%120 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %121
121: ; preds = %34, %41, %103, %119
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"APRS: \00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [2 x i8] c":\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @aprs_disp_packet(i8* %0, i32 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 14
%4 = add i32 %1, -14
%5 = getelementptr inbounds i8, i8* %0, i64 13
%6 = load i8, i8* %5
%7 = and i8 %6, 1
%8 = icmp eq i8 %7, 0
%9 = icmp ugt i32 %4, 6
%10 = and i1 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %2, %11
%12 = phi i32 [ %15, %11 ], [ %4, %2 ]
%13 = phi i8* [ %14, %11 ], [ %3, %2 ]
%14 = getelementptr inbounds i8, i8* %13, i64 7
%15 = add i32 %12, -7
%16 = getelementptr inbounds i8, i8* %13, i64 6
%17 = load i8, i8* %16
%18 = and i8 %17, 1
%19 = icmp eq i8 %18, 0
%20 = icmp ugt i32 %15, 6
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %11, label %22
22: ; preds = %11, %2
%23 = phi i8* [ %3, %2 ], [ %14, %11 ]
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 3
br i1 %25, label %26, label %72
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %23, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, -16
br i1 %29, label %30, label %72
30: ; preds = %26
%31 = tail call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%32 = getelementptr inbounds i8, i8* %0, i64 7
%33 = tail call i32 @aprs_print_ax25call(i8* %32, i32 0)
%34 = tail call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = tail call i32 @aprs_print_ax25call(i8* %0, i32 0)
%36 = load i8, i8* %5
%37 = and i8 %36, 1
%38 = icmp eq i8 %37, 0
%39 = and i1 %38, %9
br i1 %39, label %40, label %53
40: ; preds = %30, %40
%41 = phi i32 [ %46, %40 ], [ %4, %30 ]
%42 = phi i8* [ %45, %40 ], [ %3, %30 ]
%43 = tail call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%44 = tail call i32 @aprs_print_ax25call(i8* %42, i32 1)
%45 = getelementptr inbounds i8, i8* %42, i64 7
%46 = add i32 %41, -7
%47 = getelementptr inbounds i8, i8* %42, i64 6
%48 = load i8, i8* %47
%49 = and i8 %48, 1
%50 = icmp eq i8 %49, 0
%51 = icmp ugt i32 %46, 6
%52 = select i1 %50, i1 %51, i1 false
br i1 %52, label %40, label %53
53: ; preds = %40, %30
%54 = phi i8* [ %3, %30 ], [ %45, %40 ]
%55 = phi i32 [ %4, %30 ], [ %46, %40 ]
%56 = tail call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%57 = add i32 %55, -2
%58 = icmp eq i32 %57, 0
br i1 %58, label %72, label %59
59: ; preds = %53
%60 = getelementptr inbounds i8, i8* %54, i64 2
br label %61
61: ; preds = %59, %61
%62 = phi i32 [ %68, %61 ], [ %57, %59 ]
%63 = phi i8* [ %64, %61 ], [ %60, %59 ]
%64 = getelementptr inbounds i8, i8* %63, i64 1
%65 = load i8, i8* %63
%66 = zext i8 %65 to i32
%67 = tail call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = add i32 %62, -1
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %61
70: ; preds = %61
%71 = tail call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %72
72: ; preds = %53, %26, %22, %70
ret void
}