#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 uint32_t;

/* Variables and functions */
void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config) {
  ;

  ;

  ;
  (*((volatile uint32_t *)(ui32Base + 0x0000000C))) &=
      ~(0x00000001 | 0x00000100);
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) = ui32Config >> 24;
  if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
       (0x10000000 | 0x000A0000))) {
    (*((volatile uint32_t *)(ui32Base + 0x00000004))) =
        (((ui32Config & 0x000f0000) >> 4) | (ui32Config & 0xff) | 0x00000200);
    (*((volatile uint32_t *)(ui32Base + 0x00000008))) =
        (((ui32Config & 0x00f00000) >> 8) | ((ui32Config >> 8) & 0xff) |
         0x00000200);
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x00000004))) =
        ((ui32Config & 255) | 0x00000200);
    (*((volatile uint32_t *)(ui32Base + 0x00000008))) =
        (((ui32Config >> 8) & 255) | 0x00000200);
  }
}


x86 assembly (clang, -O0):
<TimerConfigure>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffefe,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
sar    $0x18,%ecx
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    %ecx,(%rax)
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x100a0000,%eax
jne    1197 <TimerConfigure+0x97>
mov    -0x8(%rbp),%ecx
and    $0xf0000,%ecx
sar    $0x4,%ecx
mov    -0x8(%rbp),%eax
and    $0xff,%eax
or     %eax,%ecx
or     $0x200,%ecx
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
and    $0xf00000,%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
or     %eax,%ecx
or     $0x200,%ecx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    %ecx,(%rax)
jmp    11cc <TimerConfigure+0xcc>
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
or     $0x200,%ecx
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
or     $0x200,%ecx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerConfigure>:
movslq %edi,%rax
andl   $0xfffffefe,0xc(%rax)
mov    %esi,%ecx
sar    $0x18,%ecx
mov    %ecx,(%rax)
mov    $0x70ff0000,%ecx
and    0x400fe000,%ecx
cmp    $0x100a0000,%ecx
jne    113d <TimerConfigure+0x3d>
mov    %esi,%edx
shr    $0x4,%edx
and    $0xf000,%edx
movzbl %sil,%ecx
or     %edx,%ecx
mov    $0xf0ff,%edx
jmp    1146 <TimerConfigure+0x46>
movzbl %sil,%ecx
mov    $0xff,%edx
or     $0x200,%ecx
mov    %ecx,0x4(%rax)
shr    $0x8,%esi
and    %edx,%esi
or     $0x200,%esi
mov    %esi,0x8(%rax)
ret

LLVM IR (-O0):
define void @TimerConfigure(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 12
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -258
store volatile i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = ashr i32 %11, 24
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 0
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
store volatile i32 %12, i32* %16
%17 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%18 = and i32 %17, 1895759872
%19 = icmp eq i32 %18, 269090816
br i1 %19, label %20, label %44
20: ; preds = %2
%21 = load i32, i32* %4
%22 = and i32 %21, 983040
%23 = ashr i32 %22, 4
%24 = load i32, i32* %4
%25 = and i32 %24, 255
%26 = or i32 %23, %25
%27 = or i32 %26, 512
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 4
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i32*
store volatile i32 %27, i32* %31
%32 = load i32, i32* %4
%33 = and i32 %32, 15728640
%34 = ashr i32 %33, 8
%35 = load i32, i32* %4
%36 = ashr i32 %35, 8
%37 = and i32 %36, 255
%38 = or i32 %34, %37
%39 = or i32 %38, 512
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 8
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i32*
store volatile i32 %39, i32* %43
br label %60
44: ; preds = %2
%45 = load i32, i32* %4
%46 = and i32 %45, 255
%47 = or i32 %46, 512
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 4
%50 = sext i32 %49 to i64
%51 = inttoptr i64 %50 to i32*
store volatile i32 %47, i32* %51
%52 = load i32, i32* %4
%53 = ashr i32 %52, 8
%54 = and i32 %53, 255
%55 = or i32 %54, 512
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 8
%58 = sext i32 %57 to i64
%59 = inttoptr i64 %58 to i32*
store volatile i32 %55, i32* %59
br label %60
60: ; preds = %44, %20
ret void
}

LLVM IR (-O2):
define void @TimerConfigure(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 12
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -258
store volatile i32 %7, i32* %5
%8 = ashr i32 %1, 24
%9 = sext i32 %0 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %8, i32* %10
%11 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%12 = and i32 %11, 1895759872
%13 = icmp eq i32 %12, 269090816
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = lshr i32 %1, 4
%16 = and i32 %15, 61440
%17 = and i32 %1, 255
%18 = or i32 %17, %16
br label %21
19: ; preds = %2
%20 = and i32 %1, 255
br label %21
21: ; preds = %19, %14
%22 = phi i32 [ %20, %19 ], [ %18, %14 ]
%23 = phi i32 [ 255, %19 ], [ 61695, %14 ]
%24 = or i32 %22, 512
%25 = add nsw i32 %0, 4
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i32*
store volatile i32 %24, i32* %27
%28 = lshr i32 %1, 8
%29 = and i32 %28, %23
%30 = or i32 %29, 512
%31 = add nsw i32 %0, 8
%32 = sext i32 %31 to i64
%33 = inttoptr i64 %32 to i32*
store volatile i32 %30, i32* %33
ret void
}