#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 SysCtlDeepSleepClockConfigSet(uint32_t ui32Div, uint32_t ui32Config) {
  uint32_t ui32Value;
  ;
  if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
       (0x10000000 | 0x00050000))) {
    (*((volatile uint32_t *)(0x400FE144))) =
        (ui32Config & ~0x1F800000) | ((ui32Div - 1) << 23);
  } else {
    ui32Value = ui32Div - 1;
    switch (ui32Config & 0x00000070) {
    case 0x00000000: {
      ui32Value |= 0x00300000;
      break;
    }
    case 0x00000030: {
      ui32Value |= 0x00200000;
      break;
    }
    case 0x00000070: {
      ui32Value |= 0x00400000;
      break;
    }
    case 0x00000010:
    default: {
      break;
    }
    }
    if (ui32Config & 0x00000002) {
      ui32Value |= 0x80000000;
    }
    if (ui32Config & 0x40000000) {
      ui32Value |= 0x40000000;
    }
    (*((volatile uint32_t *)(0x400FE144))) = ui32Value;
  }
}


x86 assembly (clang, -O0):
<SysCtlDeepSleepClockConfigSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x10050000,%eax
jne    1141 <SysCtlDeepSleepClockConfigSet+0x41>
mov    -0x8(%rbp),%ecx
and    $0xe07fffff,%ecx
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
shl    $0x17,%eax
or     %eax,%ecx
mov    $0x400fe144,%eax
mov    %ecx,(%rax)
jmp    120b <SysCtlDeepSleepClockConfigSet+0x10b>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x70,%eax
mov    %eax,-0x10(%rbp)
je     1191 <SysCtlDeepSleepClockConfigSet+0x91>
jmp    115e <SysCtlDeepSleepClockConfigSet+0x5e>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     11c1 <SysCtlDeepSleepClockConfigSet+0xc1>
jmp    116f <SysCtlDeepSleepClockConfigSet+0x6f>
mov    -0x10(%rbp),%eax
sub    $0x30,%eax
je     11a1 <SysCtlDeepSleepClockConfigSet+0xa1>
jmp    1180 <SysCtlDeepSleepClockConfigSet+0x80>
mov    -0x10(%rbp),%eax
sub    $0x70,%eax
je     11b1 <SysCtlDeepSleepClockConfigSet+0xb1>
jmp    11c6 <SysCtlDeepSleepClockConfigSet+0xc6>
mov    -0xc(%rbp),%eax
or     $0x300000,%eax
mov    %eax,-0xc(%rbp)
jmp    11cb <SysCtlDeepSleepClockConfigSet+0xcb>
mov    -0xc(%rbp),%eax
or     $0x200000,%eax
mov    %eax,-0xc(%rbp)
jmp    11cb <SysCtlDeepSleepClockConfigSet+0xcb>
mov    -0xc(%rbp),%eax
or     $0x400000,%eax
mov    %eax,-0xc(%rbp)
jmp    11cb <SysCtlDeepSleepClockConfigSet+0xcb>
jmp    11c6 <SysCtlDeepSleepClockConfigSet+0xc6>
jmp    11cb <SysCtlDeepSleepClockConfigSet+0xcb>
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11e5 <SysCtlDeepSleepClockConfigSet+0xe5>
mov    -0xc(%rbp),%eax
or     $0x80000000,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x40000000,%eax
cmp    $0x0,%eax
je     1201 <SysCtlDeepSleepClockConfigSet+0x101>
mov    -0xc(%rbp),%eax
or     $0x40000000,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x400fe144,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlDeepSleepClockConfigSet>:
mov    $0x70ff0000,%eax
and    0x400fe000,%eax
cmp    $0x10050000,%eax
jne    1124 <SysCtlDeepSleepClockConfigSet+0x24>
and    $0xe07fffff,%esi
shl    $0x17,%edi
add    $0xff800000,%edi
jmp    1163 <SysCtlDeepSleepClockConfigSet+0x63>
add    $0xffffffff,%edi
mov    %esi,%eax
shr    $0x4,%eax
and    $0x7,%eax
cmp    $0x7,%eax
je     1145 <SysCtlDeepSleepClockConfigSet+0x45>
cmp    $0x3,%eax
je     114d <SysCtlDeepSleepClockConfigSet+0x4d>
test   %eax,%eax
jne    1153 <SysCtlDeepSleepClockConfigSet+0x53>
or     $0x300000,%edi
jmp    1153 <SysCtlDeepSleepClockConfigSet+0x53>
or     $0x400000,%edi
jmp    1153 <SysCtlDeepSleepClockConfigSet+0x53>
or     $0x200000,%edi
mov    %esi,%eax
and    $0xfffffffe,%eax
shl    $0x1e,%eax
and    $0x40000000,%esi
or     %eax,%esi
or     %edi,%esi
mov    %esi,0x400fe144
ret

LLVM IR (-O0):
define void @SysCtlDeepSleepClockConfigSet(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%7 = and i32 %6, 1895759872
%8 = icmp eq i32 %7, 268763136
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i32, i32* %4
%11 = and i32 %10, -528482305
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = shl i32 %13, 23
%15 = or i32 %11, %14
store volatile i32 %15, i32* inttoptr (i64 1074782532 to i32*)
br label %48
16: ; preds = %2
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %5
%19 = load i32, i32* %4
%20 = and i32 %19, 112
switch i32 %20, label %31 [
i32 0, label %21
i32 48, label %24
i32 112, label %27
i32 16, label %30
]
21: ; preds = %16
%22 = load i32, i32* %5
%23 = or i32 %22, 3145728
store i32 %23, i32* %5
br label %32
24: ; preds = %16
%25 = load i32, i32* %5
%26 = or i32 %25, 2097152
store i32 %26, i32* %5
br label %32
27: ; preds = %16
%28 = load i32, i32* %5
%29 = or i32 %28, 4194304
store i32 %29, i32* %5
br label %32
30: ; preds = %16
br label %31
31: ; preds = %16, %30
br label %32
32: ; preds = %31, %27, %24, %21
%33 = load i32, i32* %4
%34 = and i32 %33, 2
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i32, i32* %5
%38 = or i32 %37, -2147483648
store i32 %38, i32* %5
br label %39
39: ; preds = %36, %32
%40 = load i32, i32* %4
%41 = and i32 %40, 1073741824
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i32, i32* %5
%45 = or i32 %44, 1073741824
store i32 %45, i32* %5
br label %46
46: ; preds = %43, %39
%47 = load i32, i32* %5
store volatile i32 %47, i32* inttoptr (i64 1074782532 to i32*)
br label %48
48: ; preds = %46, %9
ret void
}

LLVM IR (-O2):
define void @SysCtlDeepSleepClockConfigSet(i32 %0, i32 %1) {
%3 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%4 = and i32 %3, 1895759872
%5 = icmp eq i32 %4, 268763136
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = and i32 %1, -528482305
%8 = shl i32 %0, 23
%9 = add i32 %8, -8388608
%10 = or i32 %7, %9
br label %28
11: ; preds = %2
%12 = add nsw i32 %0, -1
%13 = lshr i32 %1, 4
%14 = and i32 %13, 7
switch i32 %14, label %21 [
i32 0, label %15
i32 3, label %17
i32 7, label %19
]
15: ; preds = %11
%16 = or i32 %12, 3145728
br label %21
17: ; preds = %11
%18 = or i32 %12, 2097152
br label %21
19: ; preds = %11
%20 = or i32 %12, 4194304
br label %21
21: ; preds = %11, %19, %17, %15
%22 = phi i32 [ %12, %11 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ]
%23 = shl i32 %1, 30
%24 = and i32 %23, -2147483648
%25 = and i32 %1, 1073741824
%26 = or i32 %24, %25
%27 = or i32 %26, %22
br label %28
28: ; preds = %21, %6
%29 = phi i32 [ %27, %21 ], [ %10, %6 ]
store volatile i32 %29, i32* inttoptr (i64 1074782532 to i32*)
ret void
}