#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 */
uint32_t SysCtlPIOSCCalibrate(uint32_t ui32Type) {
  if (ui32Type & (0x80000000 | 0x00000100)) {
    (*((volatile uint32_t *)(0x400FE150))) = ui32Type & 0x80000000;
    (*((volatile uint32_t *)(0x400FE150))) =
        ui32Type & (0x80000000 | 0x0000007F);
  }
  (*((volatile uint32_t *)(0x400FE150))) = ui32Type;
  if (ui32Type & 0x00000200) {
    while (((*((volatile uint32_t *)(0x400FE154))) & 0x00000300) == 0) {
    }
    if (((*((volatile uint32_t *)(0x400FE154))) & 0x00000300) != 0x00000100) {
      return (0);
    }
  }
  return (1);
}


x86 assembly (clang, -O0):
<SysCtlPIOSCCalibrate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80000100,%eax
cmp    $0x0,%eax
je     1138 <SysCtlPIOSCCalibrate+0x38>
mov    -0x8(%rbp),%ecx
and    $0x80000000,%ecx
mov    $0x400fe150,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
and    $0x8000007f,%ecx
mov    $0x400fe150,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    $0x400fe150,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     119a <SysCtlPIOSCCalibrate+0x9a>
jmp    1158 <SysCtlPIOSCCalibrate+0x58>
mov    $0x400fe154,%eax
mov    (%rax),%eax
and    $0x300,%eax
cmp    $0x0,%eax
jne    1172 <SysCtlPIOSCCalibrate+0x72>
jmp    1158 <SysCtlPIOSCCalibrate+0x58>
mov    $0x400fe154,%eax
mov    (%rax),%eax
and    $0x300,%eax
cmp    $0x100,%eax
je     1195 <SysCtlPIOSCCalibrate+0x95>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <SysCtlPIOSCCalibrate+0xa1>
jmp    119a <SysCtlPIOSCCalibrate+0x9a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlPIOSCCalibrate>:
test   $0x80000100,%edi
je     1124 <SysCtlPIOSCCalibrate+0x24>
mov    %edi,%eax
and    $0x80000000,%eax
mov    %eax,0x400fe150
mov    %edi,%eax
and    $0x8000007f,%eax
mov    %eax,0x400fe150
mov    %edi,0x400fe150
test   $0x200,%edi
je     1163 <SysCtlPIOSCCalibrate+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
testl  $0x300,0x400fe154
je     1140 <SysCtlPIOSCCalibrate+0x40>
mov    $0x300,%ecx
and    0x400fe154,%ecx
xor    %eax,%eax
cmp    $0x100,%ecx
jne    1168 <SysCtlPIOSCCalibrate+0x68>
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @SysCtlPIOSCCalibrate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, -2147483392
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = and i32 %8, -2147483648
store volatile i32 %9, i32* inttoptr (i64 1074782544 to i32*)
%10 = load i32, i32* %3
%11 = and i32 %10, -2147483521
store volatile i32 %11, i32* inttoptr (i64 1074782544 to i32*)
br label %12
12: ; preds = %7, %1
%13 = load i32, i32* %3
store volatile i32 %13, i32* inttoptr (i64 1074782544 to i32*)
%14 = load i32, i32* %3
%15 = and i32 %14, 512
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %29
17: ; preds = %12
br label %18
18: ; preds = %22, %17
%19 = load volatile i32, i32* inttoptr (i64 1074782548 to i32*)
%20 = and i32 %19, 768
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
br label %18
23: ; preds = %18
%24 = load volatile i32, i32* inttoptr (i64 1074782548 to i32*)
%25 = and i32 %24, 768
%26 = icmp ne i32 %25, 256
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 0, i32* %2
br label %30
28: ; preds = %23
br label %29
29: ; preds = %28, %12
store i32 1, i32* %2
br label %30
30: ; preds = %29, %27
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @SysCtlPIOSCCalibrate(i32 %0) {
%2 = and i32 %0, -2147483392
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = and i32 %0, -2147483648
store volatile i32 %5, i32* inttoptr (i64 1074782544 to i32*)
%6 = and i32 %0, -2147483521
store volatile i32 %6, i32* inttoptr (i64 1074782544 to i32*)
br label %7
7: ; preds = %4, %1
store volatile i32 %0, i32* inttoptr (i64 1074782544 to i32*)
%8 = and i32 %0, 512
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %7, %10
%11 = load volatile i32, i32* inttoptr (i64 1074782548 to i32*)
%12 = and i32 %11, 768
%13 = icmp eq i32 %12, 0
br i1 %13, label %10, label %14
14: ; preds = %10
%15 = load volatile i32, i32* inttoptr (i64 1074782548 to i32*)
%16 = and i32 %15, 768
%17 = icmp eq i32 %16, 256
br i1 %17, label %18, label %19
18: ; preds = %14, %7
br label %19
19: ; preds = %14, %18
%20 = phi i32 [ 1, %18 ], [ 0, %14 ]
ret i32 %20
}