#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 crc7(int /*<<< orphan*/, unsigned int *, int);
void mkcommand(unsigned int cmdidx, unsigned int arg, unsigned int *retcmd) {
  retcmd[0] = cmdidx;
  retcmd[1] = arg >> 24;
  retcmd[2] = arg >> 16;
  retcmd[3] = arg >> 8;
  retcmd[4] = arg;
  retcmd[5] = (0x1 | (crc7(0, retcmd, 5) << 1));
}


x86 assembly (clang, -O0):
<mkcommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
shr    $0x18,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%ecx
shr    $0x10,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%rsi
xor    %edi,%edi
mov    $0x5,%edx
call   1030 <crc7@plt>
mov    %eax,%ecx
shl    $0x1,%ecx
or     $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x14(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkcommand>:
push   %rbx
mov    %rdx,%rbx
mov    %edi,(%rdx)
mov    %esi,%eax
shr    $0x18,%eax
mov    %eax,0x4(%rdx)
mov    %esi,%eax
shr    $0x10,%eax
mov    %eax,0x8(%rdx)
mov    %esi,%eax
shr    $0x8,%eax
mov    %eax,0xc(%rdx)
mov    %esi,0x10(%rdx)
xor    %edi,%edi
mov    %rdx,%rsi
mov    $0x5,%edx
call   1030 <crc7@plt>
add    %eax,%eax
add    $0x1,%eax
mov    %eax,0x14(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @mkcommand(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %6
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %5
%11 = lshr i32 %10, 24
%12 = load i32*, i32** %6
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
%14 = load i32, i32* %5
%15 = lshr i32 %14, 16
%16 = load i32*, i32** %6
%17 = getelementptr inbounds i32, i32* %16, i64 2
store i32 %15, i32* %17
%18 = load i32, i32* %5
%19 = lshr i32 %18, 8
%20 = load i32*, i32** %6
%21 = getelementptr inbounds i32, i32* %20, i64 3
store i32 %19, i32* %21
%22 = load i32, i32* %5
%23 = load i32*, i32** %6
%24 = getelementptr inbounds i32, i32* %23, i64 4
store i32 %22, i32* %24
%25 = load i32*, i32** %6
%26 = call i32 @crc7(i32 0, i32* %25, i32 5)
%27 = shl i32 %26, 1
%28 = or i32 1, %27
%29 = load i32*, i32** %6
%30 = getelementptr inbounds i32, i32* %29, i64 5
store i32 %28, i32* %30
ret void
}

LLVM IR (-O2):
define void @mkcommand(i32 %0, i32 %1, i32* %2) {
store i32 %0, i32* %2
%4 = lshr i32 %1, 24
%5 = getelementptr inbounds i32, i32* %2, i64 1
store i32 %4, i32* %5
%6 = lshr i32 %1, 16
%7 = getelementptr inbounds i32, i32* %2, i64 2
store i32 %6, i32* %7
%8 = lshr i32 %1, 8
%9 = getelementptr inbounds i32, i32* %2, i64 3
store i32 %8, i32* %9
%10 = getelementptr inbounds i32, i32* %2, i64 4
store i32 %1, i32* %10
%11 = tail call i32 @crc7(i32 0, i32* %2, i32 5)
%12 = shl i32 %11, 1
%13 = or i32 %12, 1
%14 = getelementptr inbounds i32, i32* %2, i64 5
store i32 %13, i32* %14
ret void
}