#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_HIF_SetReg8(int, unsigned char);
void VIM_MARB_SetTimerMs(unsigned long Ms, unsigned long mclk) {
  unsigned short Num1Ms;
  Num1Ms = mclk / 1000;
  VIM_HIF_SetReg8((0x2400 + 0x0B5), (unsigned char)Num1Ms);
  VIM_HIF_SetReg8((0x2400 + 0x0B4), (unsigned char)(Num1Ms >> 8));
  VIM_HIF_SetReg8((0x2400 + 0x0B3), (unsigned char)Ms);
  VIM_HIF_SetReg8((0x2400 + 0x0B2), (unsigned char)(Ms >> 8));
  VIM_HIF_SetReg8((0x2400 + 0x0B3), (unsigned char)(Ms >> 16));
}


x86 assembly (clang, -O0):
<VIM_MARB_SetTimerMs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %ax,-0x12(%rbp)
mov    -0x12(%rbp),%ax
mov    $0x24b5,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
movzwl -0x12(%rbp),%eax
sar    $0x8,%eax
mov    $0x24b4,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
mov    -0x8(%rbp),%rax
mov    $0x24b3,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
mov    $0x24b2,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    $0x24b3,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_MARB_SetTimerMs>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r14
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
mov    %rdx,%rbx
shr    $0x4,%rbx
movzbl %bl,%esi
mov    $0x24b5,%edi
call   1030 <VIM_HIF_SetReg8@plt>
movzbl %bh,%esi
mov    $0x24b4,%edi
call   1030 <VIM_HIF_SetReg8@plt>
mov    %r14,%rbx
movzbl %bl,%esi
mov    $0x24b3,%edi
call   1030 <VIM_HIF_SetReg8@plt>
movzbl %bh,%esi
mov    $0x24b2,%edi
call   1030 <VIM_HIF_SetReg8@plt>
shr    $0x10,%ebx
movzbl %bl,%esi
mov    $0x24b3,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <VIM_HIF_SetReg8@plt>

LLVM IR (-O0):
define void @VIM_MARB_SetTimerMs(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i16
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = udiv i64 %6, 1000
%8 = trunc i64 %7 to i16
store i16 %8, i16* %5
%9 = load i16, i16* %5
%10 = trunc i16 %9 to i8
%11 = call i32 @VIM_HIF_SetReg8(i32 9397, i8 zeroext %10)
%12 = load i16, i16* %5
%13 = zext i16 %12 to i32
%14 = ashr i32 %13, 8
%15 = trunc i32 %14 to i8
%16 = call i32 @VIM_HIF_SetReg8(i32 9396, i8 zeroext %15)
%17 = load i64, i64* %3
%18 = trunc i64 %17 to i8
%19 = call i32 @VIM_HIF_SetReg8(i32 9395, i8 zeroext %18)
%20 = load i64, i64* %3
%21 = lshr i64 %20, 8
%22 = trunc i64 %21 to i8
%23 = call i32 @VIM_HIF_SetReg8(i32 9394, i8 zeroext %22)
%24 = load i64, i64* %3
%25 = lshr i64 %24, 16
%26 = trunc i64 %25 to i8
%27 = call i32 @VIM_HIF_SetReg8(i32 9395, i8 zeroext %26)
ret void
}

LLVM IR (-O2):
define void @VIM_MARB_SetTimerMs(i64 %0, i64 %1) {
%3 = udiv i64 %1, 1000
%4 = trunc i64 %3 to i8
%5 = tail call i32 @VIM_HIF_SetReg8(i32 9397, i8 zeroext %4)
%6 = lshr i64 %3, 8
%7 = trunc i64 %6 to i8
%8 = tail call i32 @VIM_HIF_SetReg8(i32 9396, i8 zeroext %7)
%9 = trunc i64 %0 to i8
%10 = tail call i32 @VIM_HIF_SetReg8(i32 9395, i8 zeroext %9)
%11 = lshr i64 %0, 8
%12 = trunc i64 %11 to i8
%13 = tail call i32 @VIM_HIF_SetReg8(i32 9394, i8 zeroext %12)
%14 = lshr i64 %0, 16
%15 = trunc i64 %14 to i8
%16 = tail call i32 @VIM_HIF_SetReg8(i32 9395, i8 zeroext %15)
ret void
}