#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*/ TimerHalActivateClock(unsigned int);
int /*<<< orphan*/ TimerHalEnableSelectedClockSource(unsigned int);
int /*<<< orphan*/ TimerHalModuleClockConfig();
int /*<<< orphan*/ TimerHalSetTimerClkSource(unsigned int, unsigned int);
int /*<<< orphan*/ TimerHalWaitForL3ClockBeingActive();
int /*<<< orphan*/ TimerHalWaitForL3SClockBeingActive();
int /*<<< orphan*/ TimerHalWaitForModuleBeingFullyFunctional(unsigned int);
int /*<<< orphan*/ TimerHalWaitForOcpwpClockBeingActive();
void TimerHalSetClockSettings(unsigned int timer,
                              unsigned int timerMuxSelectionRegister,
                              unsigned int timerClockControlRegister,
                              unsigned int clkSource) {
  TimerHalModuleClockConfig();
  TimerHalSetTimerClkSource(timerMuxSelectionRegister, clkSource);
  TimerHalEnableSelectedClockSource(timerClockControlRegister);
  TimerHalWaitForModuleBeingFullyFunctional(timerClockControlRegister);
  TimerHalWaitForL3SClockBeingActive();
  TimerHalWaitForL3ClockBeingActive();
  TimerHalWaitForOcpwpClockBeingActive();
  TimerHalActivateClock(timer);
}


x86 assembly (clang, -O0):
<TimerHalSetClockSettings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    $0x0,%al
call   1060 <TimerHalModuleClockConfig@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1070 <TimerHalSetTimerClkSource@plt>
mov    -0xc(%rbp),%edi
call   1090 <TimerHalEnableSelectedClockSource@plt>
mov    -0xc(%rbp),%edi
call   1080 <TimerHalWaitForModuleBeingFullyFunctional@plt>
mov    $0x0,%al
call   10a0 <TimerHalWaitForL3SClockBeingActive@plt>
mov    $0x0,%al
call   1030 <TimerHalWaitForL3ClockBeingActive@plt>
mov    $0x0,%al
call   1050 <TimerHalWaitForOcpwpClockBeingActive@plt>
mov    -0x4(%rbp),%edi
call   1040 <TimerHalActivateClock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerHalSetClockSettings>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
xor    %eax,%eax
call   1060 <TimerHalModuleClockConfig@plt>
mov    %ebp,%edi
mov    %r15d,%esi
call   1070 <TimerHalSetTimerClkSource@plt>
mov    %ebx,%edi
call   1090 <TimerHalEnableSelectedClockSource@plt>
mov    %ebx,%edi
call   1080 <TimerHalWaitForModuleBeingFullyFunctional@plt>
xor    %eax,%eax
call   10a0 <TimerHalWaitForL3SClockBeingActive@plt>
xor    %eax,%eax
call   1030 <TimerHalWaitForL3ClockBeingActive@plt>
xor    %eax,%eax
call   1050 <TimerHalWaitForOcpwpClockBeingActive@plt>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <TimerHalActivateClock@plt>

LLVM IR (-O0):
define void @TimerHalSetClockSettings(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = call i32 (...) @TimerHalModuleClockConfig()
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = call i32 @TimerHalSetTimerClkSource(i32 %10, i32 %11)
%13 = load i32, i32* %7
%14 = call i32 @TimerHalEnableSelectedClockSource(i32 %13)
%15 = load i32, i32* %7
%16 = call i32 @TimerHalWaitForModuleBeingFullyFunctional(i32 %15)
%17 = call i32 (...) @TimerHalWaitForL3SClockBeingActive()
%18 = call i32 (...) @TimerHalWaitForL3ClockBeingActive()
%19 = call i32 (...) @TimerHalWaitForOcpwpClockBeingActive()
%20 = load i32, i32* %5
%21 = call i32 @TimerHalActivateClock(i32 %20)
ret void
}

LLVM IR (-O2):
define void @TimerHalSetClockSettings(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 (...) @TimerHalModuleClockConfig()
%6 = tail call i32 @TimerHalSetTimerClkSource(i32 %1, i32 %3)
%7 = tail call i32 @TimerHalEnableSelectedClockSource(i32 %2)
%8 = tail call i32 @TimerHalWaitForModuleBeingFullyFunctional(i32 %2)
%9 = tail call i32 (...) @TimerHalWaitForL3SClockBeingActive()
%10 = tail call i32 (...) @TimerHalWaitForL3ClockBeingActive()
%11 = tail call i32 (...) @TimerHalWaitForOcpwpClockBeingActive()
%12 = tail call i32 @TimerHalActivateClock(i32 %0)
ret void
}