#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 multi_instance_dump(void *data, void *payload, int len) {
  unsigned char *pp = (unsigned char *)payload;
  if (pp[0] != 0x03) {
    printf("Impossible command %x\n", pp[0]);
    return;
  }
  printf("class %x has %d instance(s)\n", pp[1], pp[2]);
}


x86 assembly (clang, -O0):
<multi_instance_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 <multi_instance_dump+0x45>
mov    -0x20(%rbp),%rax
lea    0xeba(%rip),%rdi
movzbl (%rax),%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1175 <multi_instance_dump+0x65>
mov    -0x20(%rbp),%rax
mov    0x1(%rax),%al
mov    -0x20(%rbp),%rcx
movzbl 0x2(%rcx),%edx
lea    0xeac(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multi_instance_dump>:
mov    (%rsi),%al
cmp    $0x3,%al
jne    112e <multi_instance_dump+0x1e>
movzbl 0x1(%rsi),%eax
movzbl 0x2(%rsi),%edx
lea    0xef2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>
movzbl %al,%esi
lea    0xec8(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Impossible command %x\0A\00"
@.str.1 = [29 x i8] c"class %x has %d instance(s)\0A\00"
define void @multi_instance_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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8 zeroext %17)
br label %28
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 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %22, i32 %26)
br label %28
28: ; preds = %19, %14
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Impossible command %x\0A\00"
@.str.1 = [29 x i8] c"class %x has %d instance(s)\0A\00"
define void @multi_instance_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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8 zeroext %4)
br label %15
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 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %10, i32 %13)
br label %15
15: ; preds = %8, %6
ret void
}