#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 */
scalar_t__ HSMMCSDIsIntClockStable(unsigned int, int);
int HSMMCSDIntClock(unsigned int baseAddr, unsigned int pwr) {
  (*((volatile unsigned int *)(baseAddr + (0x22C)))) =
      ((*((volatile unsigned int *)(baseAddr + (0x22C)))) & ~(0x00000001u)) |
      pwr;
  if (pwr == ((0x1u) << (0x00000000u))) {
    if (HSMMCSDIsIntClockStable(baseAddr, 0xFFFF) == 0) {
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<HSMMCSDIntClock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x22c,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
or     -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
add    $0x22c,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
cmpl   $0x1,-0xc(%rbp)
jne    116e <HSMMCSDIntClock+0x5e>
mov    -0x8(%rbp),%edi
mov    $0xffff,%esi
call   1030 <HSMMCSDIsIntClockStable@plt>
cmp    $0x0,%rax
jne    1169 <HSMMCSDIntClock+0x59>
movl   $0xffffffff,-0x4(%rbp)
jmp    1175 <HSMMCSDIntClock+0x65>
jmp    116e <HSMMCSDIntClock+0x5e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HSMMCSDIntClock>:
push   %rax
lea    0x22c(%rdi),%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
or     %esi,%ecx
mov    %ecx,(%rax)
cmp    $0x1,%esi
jne    1134 <HSMMCSDIntClock+0x24>
mov    $0xffff,%esi
call   1030 <HSMMCSDIsIntClockStable@plt>
test   %rax,%rax
je     1138 <HSMMCSDIntClock+0x28>
xor    %eax,%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @HSMMCSDIntClock(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = add i32 %6, 556
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = and i32 %10, -2
%12 = load i32, i32* %5
%13 = or i32 %11, %12
%14 = load i32, i32* %4
%15 = add i32 %14, 556
%16 = zext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
store volatile i32 %13, i32* %17
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %26
20: ; preds = %2
%21 = load i32, i32* %4
%22 = call i64 @HSMMCSDIsIntClockStable(i32 %21, i32 65535)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 -1, i32* %3
br label %27
25: ; preds = %20
br label %26
26: ; preds = %25, %2
store i32 0, i32* %3
br label %27
27: ; preds = %26, %24
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @HSMMCSDIntClock(i32 %0, i32 %1) {
%3 = add i32 %0, 556
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -2
%8 = or i32 %7, %1
store volatile i32 %8, i32* %5
%9 = icmp eq i32 %1, 1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i64 @HSMMCSDIsIntClockStable(i32 %0, i32 65535)
%12 = icmp eq i64 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %10, %2
br label %14
14: ; preds = %10, %13
%15 = phi i32 [ 0, %13 ], [ -1, %10 ]
ret i32 %15
}