#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 demod_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ verbprintf(int /*<<< orphan*/, char *, ...);
void disp_packet(struct demod_state *s, unsigned char *bp, unsigned int len) {
  unsigned char i, j;
  if (!bp)
    return;
  if (!len) {
    verbprintf(0, "\n");
    return;
  }
  j = 0;
  while (len) {
    i = *bp++;
    if ((i >= 32) && (i < 128))
      verbprintf(0, "%c", i);
    else if (i == 13) {
      if (j)
        verbprintf(0, "\n");
      j = 0;
    } else
      verbprintf(0, "[0x%02X]", i);
    if (i >= 32)
      j = 1;
    len--;
  }
  if (j)
    verbprintf(0, "\n");
}


x86 assembly (clang, -O0):
<disp_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <disp_packet+0x23>
jmp    122b <disp_packet+0x11b>
cmpl   $0x0,-0x14(%rbp)
jne    1152 <disp_packet+0x42>
xor    %edi,%edi
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <verbprintf@plt>
jmp    122b <disp_packet+0x11b>
movb   $0x0,-0x16(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1211 <disp_packet+0x101>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
cmp    $0x20,%eax
jl     11a9 <disp_packet+0x99>
movzbl -0x15(%rbp),%eax
cmp    $0x80,%eax
jge    11a9 <disp_packet+0x99>
movzbl -0x15(%rbp),%edx
xor    %edi,%edi
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1030 <verbprintf@plt>
jmp    11f2 <disp_packet+0xe2>
movzbl -0x15(%rbp),%eax
cmp    $0xd,%eax
jne    11d9 <disp_packet+0xc9>
cmpb   $0x0,-0x16(%rbp)
je     11d0 <disp_packet+0xc0>
xor    %edi,%edi
lea    0xe37(%rip),%rsi
mov    $0x0,%al
call   1030 <verbprintf@plt>
movb   $0x0,-0x16(%rbp)
jmp    11ed <disp_packet+0xdd>
movzbl -0x15(%rbp),%edx
xor    %edi,%edi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1030 <verbprintf@plt>
jmp    11f2 <disp_packet+0xe2>
movzbl -0x15(%rbp),%eax
cmp    $0x20,%eax
jl     1203 <disp_packet+0xf3>
movb   $0x1,-0x16(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <disp_packet+0x46>
cmpb   $0x0,-0x16(%rbp)
je     122b <disp_packet+0x11b>
xor    %edi,%edi
lea    0xddc(%rip),%rsi
mov    $0x0,%al
call   1030 <verbprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disp_packet>:
test   %rsi,%rsi
je     11d4 <disp_packet+0xc4>
test   %edx,%edx
je     11c4 <disp_packet+0xb4>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edx,%r13d
mov    $0x1,%r15d
xor    %r12d,%r12d
xor    %r14d,%r14d
jmp    1167 <disp_packet+0x57>
xor    %edi,%edi
lea    0xeb9(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <verbprintf@plt>
cmp    $0x20,%bpl
movzbl %r14b,%r14d
cmovae %r15d,%r14d
add    $0x1,%r12
cmp    %r12d,%r13d
je     11b0 <disp_packet+0xa0>
movzbl (%rbx,%r12,1),%ebp
cmp    $0x20,%bpl
jge    1140 <disp_packet+0x30>
cmp    $0xd,%bpl
jne    11a0 <disp_packet+0x90>
test   %r14b,%r14b
je     11ab <disp_packet+0x9b>
xor    %r14d,%r14d
xor    %edi,%edi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
call   1030 <verbprintf@plt>
jmp    1152 <disp_packet+0x42>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
lea    0xe5c(%rip),%rsi
jmp    1149 <disp_packet+0x39>
xor    %r14d,%r14d
jmp    1152 <disp_packet+0x42>
test   %r14b,%r14b
lea    0x8(%rsp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
je     11d4 <disp_packet+0xc4>
lea    0xe35(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <verbprintf@plt>
ret

LLVM IR (-O0):
%struct.demod_state = type { i32 }
@.str = [2 x i8] c"\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [9 x i8] c"[0x%02X]\00"
define void @disp_packet(%struct.demod_state* %0, i8* %1, i32 %2) {
%4 = alloca %struct.demod_state*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store %struct.demod_state* %0, %struct.demod_state** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %3
br label %64
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %64
17: ; preds = %12
store i8 0, i8* %8
br label %18
18: ; preds = %56, %17
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %59
21: ; preds = %18
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %5
%24 = load i8, i8* %22
store i8 %24, i8* %7
%25 = load i8, i8* %7
%26 = zext i8 %25 to i32
%27 = icmp sge i32 %26, 32
br i1 %27, label %28, label %36
28: ; preds = %21
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = icmp slt i32 %30, 128
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %51
36: ; preds = %28, %21
%37 = load i8, i8* %7
%38 = zext i8 %37 to i32
%39 = icmp eq i32 %38, 13
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i8, i8* %8
%42 = icmp ne i8 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
store i8 0, i8* %8
br label %50
46: ; preds = %36
%47 = load i8, i8* %7
%48 = zext i8 %47 to i32
%49 = call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %46, %45
br label %51
51: ; preds = %50, %32
%52 = load i8, i8* %7
%53 = zext i8 %52 to i32
%54 = icmp sge i32 %53, 32
br i1 %54, label %55, label %56
55: ; preds = %51
store i8 1, i8* %8
br label %56
56: ; preds = %55, %51
%57 = load i32, i32* %6
%58 = add i32 %57, -1
store i32 %58, i32* %6
br label %18
59: ; preds = %18
%60 = load i8, i8* %8
%61 = icmp ne i8 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %64
64: ; preds = %11, %15, %62, %59
ret void
}

LLVM IR (-O2):
%struct.demod_state = type { i32 }
@.str = [2 x i8] c"\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [9 x i8] c"[0x%02X]\00"
define void @disp_packet(%struct.demod_state* nocapture readnone %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %1, null
br i1 %4, label %35, label %5
5: ; preds = %3
%6 = icmp eq i32 %2, 0
br i1 %6, label %33, label %7
7: ; preds = %5, %26
%8 = phi i8 [ %28, %26 ], [ 0, %5 ]
%9 = phi i8* [ %11, %26 ], [ %1, %5 ]
%10 = phi i32 [ %29, %26 ], [ %2, %5 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = zext i8 %12 to i32
%14 = icmp ugt i8 %12, 31
%15 = icmp sgt i8 %12, 31
br i1 %15, label %16, label %18
16: ; preds = %7
%17 = tail call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %26
18: ; preds = %7
%19 = icmp eq i8 %12, 13
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = icmp eq i8 %8, 0
br i1 %21, label %26, label %22
22: ; preds = %20
%23 = tail call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %26
24: ; preds = %18
%25 = tail call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %26
26: ; preds = %20, %22, %24, %16
%27 = phi i8 [ %8, %16 ], [ %8, %24 ], [ 0, %22 ], [ 0, %20 ]
%28 = select i1 %14, i8 1, i8 %27
%29 = add i32 %10, -1
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %7
31: ; preds = %26
%32 = icmp eq i8 %28, 0
br i1 %32, label %35, label %33
33: ; preds = %31, %5
%34 = tail call i32 (i32, i8*, ...) @verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %35
35: ; preds = %33, %31, %3
ret void
}