#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*/ VIM_SIF_I2cWriteByte(int, unsigned char);
void SensorSetET_SIV100B(unsigned char *RegBuf, unsigned char div) {
  unsigned char uTemp;
  unsigned short AECdata = 0;
  uTemp = *RegBuf++;
  AECdata |= (unsigned short)((uTemp & 0xff) << 8);
  uTemp = *RegBuf++;
  AECdata |= (unsigned short)(uTemp & 0xff);
  AECdata = (unsigned short)(AECdata / div);
  uTemp = AECdata % 100;
  AECdata -= uTemp;
  uTemp = (unsigned char)((AECdata >> 8) & 0xff);
  VIM_SIF_I2cWriteByte(0x30, uTemp);
  uTemp = (unsigned char)(AECdata & 0xff);
  VIM_SIF_I2cWriteByte(0x31, uTemp);
  return;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movw   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
movzwl %ax,%ecx
movzwl -0xc(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
and    $0xff,%eax
movzwl %ax,%ecx
movzwl -0xc(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
movzbl -0x9(%rbp),%ecx
cltd
idiv   %ecx
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%ecx
movzwl -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0xa(%rbp)
mov    $0x30,%edi
movzbl -0xa(%rbp),%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
movzwl -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xa(%rbp)
mov    $0x31,%edi
movzbl -0xa(%rbp),%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
movzwl (%rdi),%eax
rol    $0x8,%ax
xor    %edx,%edx
div    %si
movzwl %ax,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%eax
shr    $0x11,%eax
imul   $0x64,%eax,%ebx
movzbl %bh,%esi
mov    $0x30,%edi
call   1030 <VIM_SIF_I2cWriteByte@plt>
movzbl %bl,%esi
mov    $0x31,%edi
pop    %rbx
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetET_SIV100B(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8
%6 = alloca i16
store i8* %0, i8** %3
store i8 %1, i8* %4
store i16 0, i16* %6
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %3
%9 = load i8, i8* %7
store i8 %9, i8* %5
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = and i32 %11, 255
%13 = shl i32 %12, 8
%14 = trunc i32 %13 to i16
%15 = zext i16 %14 to i32
%16 = load i16, i16* %6
%17 = zext i16 %16 to i32
%18 = or i32 %17, %15
%19 = trunc i32 %18 to i16
store i16 %19, i16* %6
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
%22 = load i8, i8* %20
store i8 %22, i8* %5
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
%25 = and i32 %24, 255
%26 = trunc i32 %25 to i16
%27 = zext i16 %26 to i32
%28 = load i16, i16* %6
%29 = zext i16 %28 to i32
%30 = or i32 %29, %27
%31 = trunc i32 %30 to i16
store i16 %31, i16* %6
%32 = load i16, i16* %6
%33 = zext i16 %32 to i32
%34 = load i8, i8* %4
%35 = zext i8 %34 to i32
%36 = sdiv i32 %33, %35
%37 = trunc i32 %36 to i16
store i16 %37, i16* %6
%38 = load i16, i16* %6
%39 = zext i16 %38 to i32
%40 = srem i32 %39, 100
%41 = trunc i32 %40 to i8
store i8 %41, i8* %5
%42 = load i8, i8* %5
%43 = zext i8 %42 to i32
%44 = load i16, i16* %6
%45 = zext i16 %44 to i32
%46 = sub nsw i32 %45, %43
%47 = trunc i32 %46 to i16
store i16 %47, i16* %6
%48 = load i16, i16* %6
%49 = zext i16 %48 to i32
%50 = ashr i32 %49, 8
%51 = and i32 %50, 255
%52 = trunc i32 %51 to i8
store i8 %52, i8* %5
%53 = load i8, i8* %5
%54 = call i32 @VIM_SIF_I2cWriteByte(i32 48, i8 zeroext %53)
%55 = load i16, i16* %6
%56 = zext i16 %55 to i32
%57 = and i32 %56, 255
%58 = trunc i32 %57 to i8
store i8 %58, i8* %5
%59 = load i8, i8* %5
%60 = call i32 @VIM_SIF_I2cWriteByte(i32 49, i8 zeroext %59)
ret void
}

LLVM IR (-O2):
define void @SensorSetET_SIV100B(i8* nocapture %0, i8 zeroext %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %0
%5 = zext i8 %4 to i16
%6 = shl nuw i16 %5, 8
%7 = load i8, i8* %3
%8 = zext i8 %7 to i16
%9 = or i16 %6, %8
%10 = zext i8 %1 to i16
%11 = udiv i16 %9, %10
%12 = urem i16 %11, 100
%13 = sub i16 %11, %12
%14 = lshr i16 %13, 8
%15 = trunc i16 %14 to i8
%16 = tail call i32 @VIM_SIF_I2cWriteByte(i32 48, i8 zeroext %15)
%17 = trunc i16 %13 to i8
%18 = tail call i32 @VIM_SIF_I2cWriteByte(i32 49, i8 zeroext %17)
ret void
}