#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 int value;
typedef int control_id;

/* Variables and functions */
int /*<<< orphan*/ SendChar(int);
void BatchSetMeterValue(unsigned short int control_id, unsigned long value) {
  SendChar(((control_id) >> 8) & 0xFF);
  SendChar((control_id)&0xFF);
  SendChar(((4) >> 8) & 0xFF);
  SendChar((4) & 0xFF);
  SendChar((((value) >> 16) >> 8) & 0xFF);
  SendChar(((value) >> 16) & 0xFF);
  SendChar((((value)&0xFFFF) >> 8) & 0xFF);
  SendChar(((value)&0xFFFF) & 0xFF);
}


x86 assembly (clang, -O0):
<BatchSetMeterValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%edi
sar    $0x8,%edi
and    $0xff,%edi
call   1030 <SendChar@plt>
movzwl -0x2(%rbp),%edi
and    $0xff,%edi
call   1030 <SendChar@plt>
xor    %edi,%edi
call   1030 <SendChar@plt>
mov    $0x4,%edi
call   1030 <SendChar@plt>
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1030 <SendChar@plt>
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1030 <SendChar@plt>
mov    -0x10(%rbp),%rax
and    $0xffff,%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1030 <SendChar@plt>
mov    -0x10(%rbp),%rax
and    $0xffff,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1030 <SendChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchSetMeterValue>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
shr    $0x8,%edi
call   1030 <SendChar@plt>
movzbl %bl,%edi
call   1030 <SendChar@plt>
xor    %edi,%edi
call   1030 <SendChar@plt>
mov    $0x4,%edi
call   1030 <SendChar@plt>
mov    %r14,%rbx
mov    %ebx,%eax
shr    $0x18,%eax
mov    %eax,%edi
call   1030 <SendChar@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <SendChar@plt>
movzbl %bh,%edi
call   1030 <SendChar@plt>
movzbl %bl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <SendChar@plt>

LLVM IR (-O0):
define void @BatchSetMeterValue(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = ashr i32 %6, 8
%8 = and i32 %7, 255
%9 = call i32 @SendChar(i32 %8)
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = and i32 %11, 255
%13 = call i32 @SendChar(i32 %12)
%14 = call i32 @SendChar(i32 0)
%15 = call i32 @SendChar(i32 4)
%16 = load i64, i64* %4
%17 = lshr i64 %16, 16
%18 = lshr i64 %17, 8
%19 = and i64 %18, 255
%20 = trunc i64 %19 to i32
%21 = call i32 @SendChar(i32 %20)
%22 = load i64, i64* %4
%23 = lshr i64 %22, 16
%24 = and i64 %23, 255
%25 = trunc i64 %24 to i32
%26 = call i32 @SendChar(i32 %25)
%27 = load i64, i64* %4
%28 = and i64 %27, 65535
%29 = lshr i64 %28, 8
%30 = and i64 %29, 255
%31 = trunc i64 %30 to i32
%32 = call i32 @SendChar(i32 %31)
%33 = load i64, i64* %4
%34 = and i64 %33, 65535
%35 = and i64 %34, 255
%36 = trunc i64 %35 to i32
%37 = call i32 @SendChar(i32 %36)
ret void
}

LLVM IR (-O2):
define void @BatchSetMeterValue(i16 zeroext %0, i64 %1) {
%3 = zext i16 %0 to i32
%4 = lshr i32 %3, 8
%5 = tail call i32 @SendChar(i32 %4)
%6 = and i32 %3, 255
%7 = tail call i32 @SendChar(i32 %6)
%8 = tail call i32 @SendChar(i32 0)
%9 = tail call i32 @SendChar(i32 4)
%10 = trunc i64 %1 to i32
%11 = lshr i32 %10, 24
%12 = tail call i32 @SendChar(i32 %11)
%13 = lshr i32 %10, 16
%14 = and i32 %13, 255
%15 = tail call i32 @SendChar(i32 %14)
%16 = lshr i32 %10, 8
%17 = and i32 %16, 255
%18 = tail call i32 @SendChar(i32 %17)
%19 = and i32 %10, 255
%20 = tail call i32 @SendChar(i32 %19)
ret void
}