#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 */
typedef unsigned char keyid;
typedef unsigned char itemid;

/* Variables and functions */
int /*<<< orphan*/ zwave_sendClassCommand(unsigned int, int, int,
                                          unsigned char *, int);
void zwavecmd_proprietary_learn_start(unsigned int id, int itemid, int keyid) {
  unsigned char buf[256];
  buf[0] = 0x20;
  buf[1] = (itemid >> 8) & 0xff;
  buf[2] = (itemid)&0xff;
  buf[3] = (keyid >> 8) & 0xff;
  buf[4] = (keyid)&0xff;
  zwave_sendClassCommand(id, 0x88, 0x01, buf, 5);
}


x86 assembly (clang, -O0):
<zwavecmd_proprietary_learn_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movb   $0x20,-0x110(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x10f(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x10e(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x10d(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x10c(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x110(%rbp),%rcx
mov    $0x88,%esi
mov    $0x1,%edx
mov    $0x5,%r8d
call   1030 <zwave_sendClassCommand@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zwavecmd_proprietary_learn_start>:
sub    $0x108,%rsp
mov    %esi,%eax
movb   $0x20,(%rsp)
mov    %ah,0x1(%rsp)
mov    %al,0x2(%rsp)
mov    %dh,0x3(%rsp)
mov    %dl,0x4(%rsp)
mov    %rsp,%rcx
mov    $0x88,%esi
mov    $0x1,%edx
mov    $0x5,%r8d
call   1030 <zwave_sendClassCommand@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
define void @zwavecmd_proprietary_learn_start(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [256 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
store i8 32, i8* %8
%9 = load i32, i32* %5
%10 = ashr i32 %9, 8
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 1
store i8 %12, i8* %13
%14 = load i32, i32* %5
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 2
store i8 %16, i8* %17
%18 = load i32, i32* %6
%19 = ashr i32 %18, 8
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i8
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 3
store i8 %21, i8* %22
%23 = load i32, i32* %6
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 4
store i8 %25, i8* %26
%27 = load i32, i32* %4
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%29 = call i32 @zwave_sendClassCommand(i32 %27, i32 136, i32 1, i8* %28, i32 5)
ret void
}

LLVM IR (-O2):
define void @zwavecmd_proprietary_learn_start(i32 %0, i32 %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
store i8 32, i8* %5
%6 = lshr i32 %1, 8
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 1
store i8 %7, i8* %8
%9 = trunc i32 %1 to i8
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 2
store i8 %9, i8* %10
%11 = lshr i32 %2, 8
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 3
store i8 %12, i8* %13
%14 = trunc i32 %2 to i8
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 4
store i8 %14, i8* %15
%16 = call i32 @zwave_sendClassCommand(i32 %0, i32 136, i32 1, i8* %5, i32 5)
ret void
}