#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;
  (void)s;
  if (!bp)
    return;
  if (!len) {
    do {
      if (0 <= 0)
        _verbprintf(0, "\n");
    } while (0);
    return;
  }
  j = 0;
  while (len) {
    i = *bp++;
    if ((i >= 32) && (i < 128))
      do {
        if (0 <= 0)
          _verbprintf(0, "%c", i);
      } while (0);
    else if (i == 13) {
      if (j)
        do {
          if (0 <= 0)
            _verbprintf(0, "\n");
        } while (0);
      j = 0;
    } else
      do {
        if (0 <= 0)
          _verbprintf(0, "[0x%02X]", i);
      } while (0);
    if (i >= 32)
      j = 1;
    len--;
  }
  if (j)
    do {
      if (0 <= 0)
        _verbprintf(0, "\n");
    } while (0);
}


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    1253 <disp_packet+0x143>
cmpl   $0x0,-0x14(%rbp)
jne    1157 <disp_packet+0x47>
jmp    1142 <disp_packet+0x32>
xor    %edi,%edi
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1030 <_verbprintf@plt>
jmp    1253 <disp_packet+0x143>
movb   $0x0,-0x16(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     122f <disp_packet+0x11f>
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     11b3 <disp_packet+0xa3>
movzbl -0x15(%rbp),%eax
cmp    $0x80,%eax
jge    11b3 <disp_packet+0xa3>
jmp    119a <disp_packet+0x8a>
movzbl -0x15(%rbp),%edx
xor    %edi,%edi
lea    0xe5b(%rip),%rsi
mov    $0x0,%al
call   1030 <_verbprintf@plt>
jmp    1210 <disp_packet+0x100>
movzbl -0x15(%rbp),%eax
cmp    $0xd,%eax
jne    11ed <disp_packet+0xdd>
cmpb   $0x0,-0x16(%rbp)
je     11e4 <disp_packet+0xd4>
jmp    11cf <disp_packet+0xbf>
xor    %edi,%edi
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1030 <_verbprintf@plt>
jmp    11e4 <disp_packet+0xd4>
movb   $0x0,-0x16(%rbp)
jmp    120b <disp_packet+0xfb>
jmp    11f2 <disp_packet+0xe2>
movzbl -0x15(%rbp),%edx
xor    %edi,%edi
lea    0xe06(%rip),%rsi
mov    $0x0,%al
call   1030 <_verbprintf@plt>
jmp    120b <disp_packet+0xfb>
jmp    1210 <disp_packet+0x100>
movzbl -0x15(%rbp),%eax
cmp    $0x20,%eax
jl     1221 <disp_packet+0x111>
movb   $0x1,-0x16(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <disp_packet+0x4b>
cmpb   $0x0,-0x16(%rbp)
je     1253 <disp_packet+0x143>
jmp    123e <disp_packet+0x12e>
xor    %edi,%edi
lea    0xdb9(%rip),%rsi
mov    $0x0,%al
call   1030 <_verbprintf@plt>
jmp    1253 <disp_packet+0x143>
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 %struct.demod_state*, %struct.demod_state** %4
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %3
br label %75
13: ; preds = %3
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %13
br label %17
17: ; preds = %16
%18 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17
br label %75
20: ; preds = %13
store i8 0, i8* %8
br label %21
21: ; preds = %65, %20
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %68
24: ; preds = %21
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %5
%27 = load i8, i8* %25
store i8 %27, i8* %7
%28 = load i8, i8* %7
%29 = zext i8 %28 to i32
%30 = icmp sge i32 %29, 32
br i1 %30, label %31, label %41
31: ; preds = %24
%32 = load i8, i8* %7
%33 = zext i8 %32 to i32
%34 = icmp slt i32 %33, 128
br i1 %34, label %35, label %41
35: ; preds = %31
br label %36
36: ; preds = %35
%37 = load i8, i8* %7
%38 = zext i8 %37 to i32
%39 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %36
br label %60
41: ; preds = %31, %24
%42 = load i8, i8* %7
%43 = zext i8 %42 to i32
%44 = icmp eq i32 %43, 13
br i1 %44, label %45, label %53
45: ; preds = %41
%46 = load i8, i8* %8
%47 = icmp ne i8 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45
br label %49
49: ; preds = %48
%50 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %51
51: ; preds = %49
br label %52
52: ; preds = %51, %45
store i8 0, i8* %8
br label %59
53: ; preds = %41
br label %54
54: ; preds = %53
%55 = load i8, i8* %7
%56 = zext i8 %55 to i32
%57 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %54
br label %59
59: ; preds = %58, %52
br label %60
60: ; preds = %59, %40
%61 = load i8, i8* %7
%62 = zext i8 %61 to i32
%63 = icmp sge i32 %62, 32
br i1 %63, label %64, label %65
64: ; preds = %60
store i8 1, i8* %8
br label %65
65: ; preds = %64, %60
%66 = load i32, i32* %6
%67 = add i32 %66, -1
store i32 %67, i32* %6
br label %21
68: ; preds = %21
%69 = load i8, i8* %8
%70 = icmp ne i8 %69, 0
br i1 %70, label %71, label %75
71: ; preds = %68
br label %72
72: ; preds = %71
%73 = call i32 (i32, i8*, ...) @_verbprintf(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %74
74: ; preds = %72
br label %75
75: ; preds = %12, %19, %74, %68
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
}