#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*/ printf(char *, ...);
void zwavecmd_proprietary_dump(void *data, void *payload, int len) {
  unsigned char *pp = (unsigned char *)payload;
  if (pp[0] == 0x03) {
    int i;
    for (i = 1; i < len; i++) {
      printf("%x ", pp[i]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<zwavecmd_proprietary_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x3,%eax
jne    1184 <zwavecmd_proprietary_dump+0x74>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1176 <zwavecmd_proprietary_dump+0x66>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <zwavecmd_proprietary_dump+0x32>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zwavecmd_proprietary_dump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmpb   $0x3,(%rsi)
jne    117d <zwavecmd_proprietary_dump+0x5d>
cmp    $0x2,%edx
jl     1168 <zwavecmd_proprietary_dump+0x48>
mov    %rsi,%r12
mov    %edx,%r15d
mov    $0x1,%ebx
lea    0xebc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r12,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <zwavecmd_proprietary_dump+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%x \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @zwavecmd_proprietary_dump(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %5
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %33
15: ; preds = %3
store i32 1, i32* %8
br label %16
16: ; preds = %28, %15
%17 = load i32, i32* %8
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load i8*, i8** %7
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %20
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %16
31: ; preds = %16
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %31, %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x \00"
define void @zwavecmd_proprietary_dump(i8* nocapture readnone %0, i8* nocapture %1, i32 %2) {
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 3
br i1 %5, label %6, label %20
6: ; preds = %3
%7 = icmp sgt i32 %2, 1
br i1 %7, label %8, label %18
8: ; preds = %6
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 1, %8 ], [ %16, %10 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, %9
br i1 %17, label %18, label %10
18: ; preds = %10, %6
%19 = tail call i32 @putchar(i32 10)
br label %20
20: ; preds = %18, %3
ret void
}