#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 *, unsigned char, ...);
void zwavecmd_actuator_dump(void *data, void *payload, int len) {
  unsigned char *pp = (unsigned char *)payload;
  if (pp[0] != 0x03) {
    printf("Unknown command(%x)\n", pp[0]);
    return;
  }
  printf("Scene %d level %d duration %d\n", pp[1], pp[2], pp[3]);
}


x86 assembly (clang, -O0):
<zwavecmd_actuator_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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
je     1155 <zwavecmd_actuator_dump+0x45>
mov    -0x20(%rbp),%rax
lea    0xeba(%rip),%rdi
movzbl (%rax),%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117d <zwavecmd_actuator_dump+0x6d>
mov    -0x20(%rbp),%rax
mov    0x1(%rax),%al
mov    -0x20(%rbp),%rcx
movzbl 0x2(%rcx),%edx
mov    -0x20(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
lea    0xea2(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zwavecmd_actuator_dump>:
mov    (%rsi),%al
cmp    $0x3,%al
jne    1132 <zwavecmd_actuator_dump+0x22>
movzbl 0x1(%rsi),%eax
movzbl 0x2(%rsi),%edx
movzbl 0x3(%rsi),%ecx
lea    0xeec(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>
movzbl %al,%esi
lea    0xec4(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [21 x i8] c"Unknown command(%x)\0A\00"
@.str.1 = [31 x i8] c"Scene %d level %d duration %d\0A\00"
define void @zwavecmd_actuator_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 %8, label %6
6: ; preds = %3
%7 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8 zeroext %4)
br label %18
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %1, i64 1
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = getelementptr inbounds i8, i8* %1, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %10, i32 %13, i32 %16)
br label %18
18: ; preds = %8, %6
ret void
}